Comments (5)
Got it like this:
sensor:
- platform: custom
lambda: |-
return ((MhiAcCtrl*)id(${deviceid}))->get_sensors();
# Sensor names in HA, you can change these if you want
# Don't delete them or change their position in the list
sensors:
- name: ${devicename} - Error Code
- name: ${devicename} - Outdoor Temperature
- name: ${devicename} - Return Air Temperature
- name: ${devicename} - Outdoor Unit Fan Speed
- name: ${devicename} - Indoor Unit Fan Speed
- name: ${devicename} - Current Amperage
id: ampere
- name: ${devicename} - Compressor Frequency
- name: ${devicename} - Indoor Unit Total Run Time
- name: ${devicename} - Compressor Total Run Time
- platform: template
name: ${devicename} - Current Power
id: "power"
unit_of_measurement: W
lambda: return id(ampere).state * 230;
- platform: total_daily_energy
name: "${devicename} - Dagverbruik"
power_id: "power"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
- throttle: 300s
unit_of_measurement: kWh
icon: mdi:clock-alert
It does it for now. To get an "idea". Later I will import the actual voltage but for now this is fine.
thanks!
from mhi-ac-ctrl-esphome.
That 'power' attribute is not energy (Kwh like you're after) but current. So amperage. What you want to do is technically impossible. You could however set up some complex formula that also takes into consideration the actual voltage and then calculate the watts, poll that value and take the average to sum up as Kwh, but it's just not going to be anywhere near reliable this way. Better to just insert a CT clamp/Kwh meter between the unit and your mains power.
from mhi-ac-ctrl-esphome.
Thank you, and yes, stupid A is not W, I will make that P=U*I :-).
But apart from that, will the "id:power" in esphome provide me the value? to be usable in templates etc.?
And why is is even called "power" if it Amps :-), shouldnt it be "Amperage"?
from mhi-ac-ctrl-esphome.
Very valid point. I guess I doubted there a bit when I refactored the sensor name(s)/id(s). The library we use calls it 'power' internally, I guess I made 'current power' of that just to keep a reference for the people that used the library natively before.
But yes, current (so not current power) would be the more accurate label/sensor ID.
EDIT: sorry, missed your last question. You could do something like this in HA automations by using a template (value_template
or payload_value
for example). Do not forget to replace sensor.mhi_current_power
with the unique sensor id from the mhi unit based on your own yaml contents and sensor.energy_meter_volts
with a recent volt reading of the phase the mhi unit is on from your home energy meter (or use a static value like 230 but it will not be very accurate).
{{ states('sensor.mhi_current_power') | int * states('sensor.energy_meter_volts') | int }}
from mhi-ac-ctrl-esphome.
Actually, someone already posted a pretty complete example here as well; #21 (comment). You can also do it in ESPHome (like you are trying to do), but that requires polling the volt value from your smart meter into the ESP. Which is kind of cumbersome to say the least. If you just want to use a static volt reading/number, doing the calculation in the ESP is absolutely fine.
from mhi-ac-ctrl-esphome.
Related Issues (20)
- Power Status always on on reboot HOT 4
- Change status icon when air conditioner mode is changed HOT 1
- Strange temperature readings when at least one of my ACs is turned ON HOT 4
- Restore previous settings from hassio HOT 3
- Forked, but up-to-date? HOT 4
- Climate degrees steps HOT 3
- Low, Medium, High, Auto HOT 18
- When turning on heating - temp up by 2 degrees HOT 2
- Room Temperature HOT 13
- Total run time is, was and stays 100h HOT 11
- ESP32 - D1 Mini Pro HOT 24
- Current power - indoor and/or outdoor? HOT 3
- (Default) update_interval? HOT 1
- Vane up/down control resets vane left/right HOT 5
- Control fanspeed and swingposition through webserver HOT 5
- DS18B20 as external temperature sensor HOT 2
- MHI-AC-Ctrl v2.6 update? HOT 13
- Since ESPheom update I get an error: warning: 'esphome::climate::Climate::away' is deprecated: away is deprecated, use preset instead [-Wdeprecated-declarations] HOT 3
- Understanding energy consumption
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mhi-ac-ctrl-esphome.