home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
68.74k stars 28.07k forks source link

Update of the Homematic IP Cloud Rest API für HmIP-ESI-IEC #109055

Open FlipFlopFlippi opened 3 months ago

FlipFlopFlippi commented 3 months ago

The problem

The Homematic IP Rest Api has been updated and now supports the HmIP-ESI-IEC energy meter, among others

GitHub

GitHub - hahn-th/homematicip-rest-api: A python wrapper for the homematicIP... A python wrapper for the homematicIP REST API (Access Point Based) - GitHub - hahn-th/homematicip-rest-api: A python wrapper for the homematicIP REST API (Access Point Based)

It would be great if the corresponding integration would be updated accordingly

What version of Home Assistant Core has the issue?

2024.1.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Homamatic IP Cloud

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homematicip_cloud/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 months ago

homematicip_cloud documentation homematicip_cloud source

ChristophCaina commented 3 months ago

same as #108775

hahn-th commented 1 month ago

Can you tell me, what units the numbers are? EnergyCounterOn / Two / Three Gas VolumePerImpulse

I can see at least 4 Sensors:

What are the energyCounter*Type Variables? Are they need or important?

Please give more Infos about the variables. What is neccessary? What are they for?

"currentGasFlow": null,
"currentPowerConsumption": 524.0,
"energyCounterOne": 7234.7096,
"energyCounterOneType": "ENERGY_COUNTER_USAGE_HIGH_TARIFF",
"energyCounterThree": null,
"energyCounterThreeType": "UNKNOWN",
"energyCounterTwo": 0.0,
"energyCounterTwoType": "ENERGY_COUNTER_USAGE_LOW_TARIFF",
"functionalChannelType": "ENERGY_SENSORS_INTERFACE_CHANNEL",
"gasVolume": null,
"gasVolumePerImpulse": 0.01,
StBoom commented 1 month ago

I have https://de.elv.com/homematic-ip-smart-home-schnittstelle-fuer-smart-meter-digitale-stromzaehler-hmip-esi-iec-159672

and the only info i see is the battery state of the device.

Bjoerns-TB commented 1 month ago

Hi,

currentPowerConsumption is in Watt (W). The three others are measured in kilowatt hours (kWh).

I'am assuming that CounterOne is for normal/high tarif, CounterTwo for low tarif (during the night e.g.) and counterTree for delivered/returned energy (from solar e.g.). So all three are neccessary.

P4TR1CK-V3LT3 commented 1 month ago

Hi,

the energy sensor interface "HmIP-ESI" currently supports three different sensors, the power sensor for smart meters (IEC), the sensor for digital power meters (LED) and the sensor for gas meters (GAS). The data provided seem to be a mixture of power and gas related metrics, depending on which sensor is attached to ESI.

According to the manual, HmIP-ESI-IEC is providing the following data:

I would interpret the data as following – but these are just assumptions:

"currentGasFlow": null,

Not used for IEC or LED sensor "currentPowerConsumption": 524.0, Current power consumption in Watt or Kilowatt, in my case here it’s Watt "energyCounterOne": 7234.7096, Current energy counter according to "energyCounterOneType", in my case High Tariff "energyCounterOneType": "ENERGY_COUNTER_USAGE_HIGH_TARIFF", "energyCounterThree": null, Current energy counter according to "energyCounterThreeType", likely the Feed-in in kWh, not used in my case therefore null "energyCounterThreeType": "UNKNOWN", "energyCounterTwo": 0.0, Current energy counter according to "energyCounterTwoType", likely the Low Tariff in kWh, not used in my case therefore null "energyCounterTwoType": "ENERGY_COUNTER_USAGE_LOW_TARIFF", "gasVolume": null, Not used for IEC or LED sensor "gasVolumePerImpulse": 0.01, Not used for IEC or LED sensor

The Gas sensor HmIP-ESI-GAS is providing the following data:

As the Gas sensor is a mechanical sensor which acquires the magnetical impulse of a gas meter, the gas counter and gas flow is not read from the gas meter but is calculated internally depending on the amount of impulses (rotations).

I would interpret the data as following – but these are just assumptions:

"currentGasFlow": 1.03,

Current gas flow in m3/h "currentPowerConsumption": null, Not used for GAS sensor "energyCounterOne": null,
Not used for GAS sensor "energyCounterOneType": "UNKNOWN", Not used for GAS sensor "energyCounterThree": null, Not used for GAS sensor "energyCounterThreeType": "UNKNOWN", Not used for GAS sensor "energyCounterTwo": null, Not used for GAS sensor "energyCounterTwoType": "UNKNOWN", Not used for GAS sensor "gasVolume": 1019.26, Current gas counter in m3 "gasVolumePerImpulse": 0.01, Required during setup of the sensor to properly calculate the volume per mechanical impulse.

hahn-th commented 4 weeks ago

If you have the ESI_IEC device there are following mappings: energyCounterOne: High Tariff energyCounterTwo: Low Tariff energyCounterThree: Input single Tariff

What happens with the mappings, if you have not set up a low Tariff? Is the Input single Tariff still mapped to energyCounterThree?

Bjoerns-TB commented 4 weeks ago

Yes, this is static. Counter One will be used for single/high tariff, counter two for low tariff and counter three for feed in.

etalon commented 4 weeks ago

Hey Folks, I wanted to offer some help. Never participated in open source, but I am a software developer and I have an installed ESI Smart Meter connected to my Homematic Access Point. So if you need a test person, feel free to get in contact with me. My home assistant is freshly installed today in a docker container. So not much to loose.

hahn-th commented 3 weeks ago

@etalon Nice to hear. I am nearly done. But the sun is shining... :) Someday this week its done

fuqu00f commented 3 weeks ago

Is any further input needed for the ES_GAS?

Enjoy the sun and thanks for your work

sizzos commented 3 weeks ago

I just installed the HmIP-ESI-GAS and could also provide information if needed. Thanks for your effort!

etalon commented 2 weeks ago

@hahn-th Can I Support you? Or is it already done?

hahn-th commented 2 weeks ago

@hahn-th Can I Support you? Or is it already done?

If you like, i can push my changes to my dev branch, you can fork that branch and finish it. I already made the main work. The rest is more or less copy and paste. And maybe add test cases to cover all code.

hahn-th commented 2 weeks ago

@fuqu00f @sizzos can someone of you please upload your gas sensor? Or can you confirm, that this is correct? (https://github.com/home-assistant/core/issues/109055#issuecomment-2003722178)

I would interpret the data as following – but these are just assumptions: "currentGasFlow": 1.03, Current gas flow in m3/h "currentPowerConsumption": null, Not used for GAS sensor "energyCounterOne": null, Not used for GAS sensor "energyCounterOneType": "UNKNOWN", Not used for GAS sensor "energyCounterThree": null, Not used for GAS sensor "energyCounterThreeType": "UNKNOWN", Not used for GAS sensor "energyCounterTwo": null, Not used for GAS sensor "energyCounterTwoType": "UNKNOWN", Not used for GAS sensor "gasVolume": 1019.26, Current gas counter in m3 "gasVolumePerImpulse": 0.01, Required during setup of the sensor to properly calculate the volume per mechanical impulse.

sizzos commented 2 weeks ago

IMG_7398

IMG_7397

@fuqu00f @sizzos can someone of you please upload your gas sensor? Or can you confirm, that this is correct? (#109055 (comment))

I would interpret the data as following – but these are just assumptions: "currentGasFlow": 1.03, Current gas flow in m3/h "currentPowerConsumption": null, Not used for GAS sensor "energyCounterOne": null, Not used for GAS sensor "energyCounterOneType": "UNKNOWN", Not used for GAS sensor "energyCounterThree": null, Not used for GAS sensor "energyCounterThreeType": "UNKNOWN", Not used for GAS sensor "energyCounterTwo": null, Not used for GAS sensor "energyCounterTwoType": "UNKNOWN", Not used for GAS sensor "gasVolume": 1019.26, Current gas counter in m3 "gasVolumePerImpulse": 0.01, Required during setup of the sensor to properly calculate the volume per mechanical impulse.

Which info exactly do you need?

I can confirm:

fuqu00f commented 2 weeks ago

Hi,

from my Hmip dump in HA from two different days:

Latest:

"1": { "channelRole": null, "connectedEnergySensorType": "ES_GAS", "currentGasFlow": 1.42, currently using Gas "currentPowerConsumption": null, "deviceId": "3014F7110000000000000044", "energyCounterOne": null, "energyCounterOneType": "UNKNOWN", "energyCounterThree": null, "energyCounterThreeType": "UNKNOWN", "energyCounterTwo": null, "energyCounterTwoType": "UNKNOWN", "functionalChannelType": "ENERGY_SENSORS_INTERFACE_CHANNEL", "gasVolume": 35827.97, Value on the gas counter in m^3 "gasVolumePerImpulse": 0.01, one impulse of the counter is 0.01 m^3 "groupIndex": 1, "groups": [ "00000000-0000-0000-0000-000000000075" ], "impulsesPerKWH": 10000, i do not see kWh value in the homeatic app and where I can set this value but that depends on the Gas you receive how many impules=how many m^3=how many kWh "index": 1, "label": "", "supportedOptionalFeatures": { "IOptionalFeatureCounterOffset": true, "IOptionalFeatureCurrentGasFlow": true, "IOptionalFeatureCurrentPowerConsumption": false, "IOptionalFeatureEnergyCounterOne": false, "IOptionalFeatureEnergyCounterThree": false, "IOptionalFeatureEnergyCounterTwo": false, "IOptionalFeatureGasVolume": true, "IOptionalFeatureGasVolumePerImpulse": true, "IOptionalFeatureImpulsesPerKWH": false }

older date:

             "1": {
                 "channelRole": null,
                 "connectedEnergySensorType": "ES_GAS",
                 "currentGasFlow": 0.0,

no gas flow currently "currentPowerConsumption": null, "deviceId": "3014F7110000000000000044", "energyCounterOne": null, "energyCounterOneType": "UNKNOWN", "energyCounterThree": null, "energyCounterThreeType": "UNKNOWN", "energyCounterTwo": null, "energyCounterTwoType": "UNKNOWN", "functionalChannelType": "ENERGY_SENSORS_INTERFACE_CHANNEL", "gasVolume": 35801.3, older counter value "gasVolumePerImpulse": 0.01, "groupIndex": 1, "groups": [ "00000000-0000-0000-0000-000000000075" ],

Further part of the dump

         "homeId": "00000000-0000-0000-0000-000000000001",
         "id": "3014F7110000000000000044",
         "label": "Gasz\u00e4hler",
         "lastStatusUpdate": 1712485529215,
         "liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
         "manuallyUpdateForced": false,
         "manufacturerCode": 1,
         "measuredAttributes": {
             "1": {
                 "currentGasFlow": true,
                 "gasVolume": true
             }
         },
         "modelId": 509,
         "modelType": "HmIP-ESI",
         "oem": "eQ-3",
         "permanentlyReachable": false,
         "serializedGlobalTradeItemNumber": "3014F7110000000000000044",
         "type": "ENERGY_SENSORS_INTERFACE",
         "updateState": "UP_TO_DATE"
     }
hahn-th commented 1 week ago

@hahn-th Can I Support you? Or is it already done?

Hey. Can you test this branch if devices are shown correctly UI?

etalon commented 1 week ago

@hahn-th Can I Support you? Or is it already done?

Hey. Can you test this branch if devices are shown correctly UI?

Is there a short Readme or documentation which files I have to replace where? I have home assistant installed on a docker container.

hahn-th commented 1 week ago

@etalon You could setup your dev env as described here: https://developers.home-assistant.io/docs/development_environment and then you can run home assistant. I dont know if you could replace the files in your docker environment. My changes are in homeassistant/components/homematicip_cloud/ This is my branch: https://github.com/hahn-th/core/tree/109055

cs42 commented 1 week ago

@hahn-th : I just installed your branch, sensors for the energy counters are found an update but they have the wrong unit! They announce as "kW" instead of "kWh" and are not usable as energy source in the energy dashboard.

Additionally there're still the messages:

2024-04-20 05:40:56.957 WARNING (MainThread) [homematicip.base.enums] 'ENERGY' isn't a valid option for class 'GroupType'
2024-04-20 05:40:56.958 WARNING (MainThread) [homematicip.home] There is no class for group 'ENERGY' yet

at start up.

hahn-th commented 1 week ago

@cs42 Thx! Is the Current Power Consumption sensor correct? I guess its measurement.

cs42 commented 1 week ago

@cs42 Thx! Is the Current Power Consumption sensor correct? I guess its measurement.

Yes, seems so, it reports in Watts.

One thing I still notice with the energy sensors: if I add them to the energy dashboard I get the message

Last reset missing The following entities have state class 'measurement' but 'last_reset' is missing:

for the sensors. I don't know how to fix this, though.

hahn-th commented 1 week ago

@cs42 Instead of measurement the kWh Sensors must be TOTAL_INCREASING.

Would you be so kind and implement the LED device too? It is nearly the same as the ECI, but with different fields. Somewhere above somebody provides informations about that.

cs42 commented 1 week ago

@cs42 Instead of measurement the kWh Sensors must be TOTAL_INCREASING.

Would you be so kind and implement the LED device too? It is nearly the same as the ECI, but with different fields. Somewhere above somebody provides informations about that.

@hahn-th after changing to TOTAL_INCREASING the sensors work as expected in energy dashboard.

f-l-o-w123 commented 1 week ago

Would you be so kind and implement the LED device too? It is nearly the same as the ECI, but with different fields. Somewhere above somebody provides informations about that.

@hahn-th I have the LED device. Can you give advice how to test and implement it?

cs42 commented 1 week ago

@f-l-o-w123 depends, what data the LED version gives. If it is basically the same as ESI, then it is easy and I tried to implement it. To test use this branch https://github.com/cs42/homeassistant_core/tree/109055, actually I do not have this device as I have the IEC version.

f-l-o-w123 commented 1 week ago

@f-l-o-w123 depends, what data the LED version gives. If it is basically the same as ESI, then it is easy and I tried to implement it. To test use this branch https://github.com/cs42/homeassistant_core/tree/109055, actually I do not have this device as I have the IEC version.

Thanks. Unfortunatelly I can't replace files as I use a docker installations of HA.

Don't know if helpful but I can share my config file for the ESI-LED version:

"channelRole": "ENERGY_SENSOR",
                    "connectedEnergySensorType": "ES_LED",
                    "currentGasFlow": null,
                    "currentPowerConsumption": 189.15,
                    "deviceId": "3014F7110000000000000024",
                    "energyCounterOne": 23825.748,
                    "energyCounterOneType": "UNKNOWN",
                    "energyCounterThree": null,
                    "energyCounterThreeType": "UNKNOWN",
                    "energyCounterTwo": null,
                    "energyCounterTwoType": "UNKNOWN",
                    "functionalChannelType": "ENERGY_SENSORS_INTERFACE_CHANNEL",
                    "gasVolume": null,
                    "gasVolumePerImpulse": 0.01,
                    "groupIndex": 1,
                    "groups": [
                        "00000000-0000-0000-0000-000000000057"
                    ],
                    "impulsesPerKWH": 1000,
                    "index": 1,
                    "label": "",
                    "supportedOptionalFeatures": {
                        "IOptionalFeatureCounterOffset": true,
                        "IOptionalFeatureCurrentGasFlow": false,
                        "IOptionalFeatureCurrentPowerConsumption": true,
                        "IOptionalFeatureEnergyCounterOne": true,
                        "IOptionalFeatureEnergyCounterThree": false,
                        "IOptionalFeatureEnergyCounterTwo": false,
                        "IOptionalFeatureGasVolume": false,
                        "IOptionalFeatureGasVolumePerImpulse": false,
                        "IOptionalFeatureImpulsesPerKWH": true
                    }
                }
            },
            "homeId": "00000000-0000-0000-0000-000000000001",
            "id": "3014F7110000000000000024",
            "label": "Stromz\u00e4hler",
            "lastStatusUpdate": 1713537117403,
            "liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
            "manuallyUpdateForced": false,
            "manufacturerCode": 1,
            "measuredAttributes": {
                "1": {
                    "currentPowerConsumption": true,
                    "energyCounterOne": true
                }
            },
            "modelId": 509,
            "modelType": "HmIP-ESI",
            "oem": "eQ-3",
            "permanentlyReachable": false,
            "serializedGlobalTradeItemNumber": "3014F7110000000000000024",
            "type": "ENERGY_SENSORS_INTERFACE",
            "updateState": "UP_TO_DATE"
etalon commented 4 days ago

Hello, what is open to finish this issue? Can't wait for the Update ;)

hahn-th commented 3 days ago

how far are you with testing the led device? @f-l-o-w123

i have to fix the gas device. Gonna happen this week.

f-l-o-w123 commented 2 days ago

@hahn-th: It was not possible to replace files as I am using a docker installation and a VM version of HA. I shared my config file for the ESI-LED version instead two posts above. Don't know if helpful..

If you have any other idea how to test the implementations with my docker/VM installation, I am open to give it a try.

Reuda84 commented 2 days ago

image

I installed a Dev Environment. Sensore seems to work. Could also select the data in the engerieboard. But I get the following error message.

image

cs42 commented 1 day ago

@Reuda84 I simplified the definition of the LED device (removed HIGH and LOW tariffs, as I do not think that will be provided by the LED device ever). Could you please test again?