openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

[somfytahoma] Add ElectricitySensor support #4389

Closed Houdinain closed 5 years ago

Houdinain commented 5 years ago

Hi,

I have several Thermor "Equateur 3" electric radiators, programmed by openhab through a tahoma box (their command was detected as on/off heating system with target_heating_level instead of heating system with target_temperature, but nothing some tweaking in the json database couldn't fix)
They are supposed to have an electric consumption meter somewhere, accessible through the "cosytouch" bridge Thermor sells, and I haven't found it in the tahoma interface.
Nonetheless, openhab logs tell me that an ElectricitySensor is declared by the tahoma bridge, hereafter is the information given :
2018-12-16 16:00:45.814 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Detected a new unsupported device: ElectricitySensor 2018-12-16 16:00:45.814 [INFO ] [very.SomfyTahomaItemDiscoveryService] - If you want to add the support, please create a new issue and attach the information below 2018-12-16 16:00:45.814 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Supported commands: { } 2018-12-16 16:00:45.814 [WARN ] [very.SomfyTahomaItemDiscoveryService] - Device states: {name='core:StatusState', type=3, value=available}

If there is something I can do to help, don't hesitate to contact me. (I'm currently running OH 2.3.0 on windows)

Thanks, Colin.

octa22 commented 5 years ago

Hi, according to the log you provided, there is really an ElectricitySensor device, but the only state is the availability. Nothing more. So I cannot get the current electricity consumption :-( If you want to fix the detection of your radiator, please provide me with the debug log when you hit the Somfy Tahoma discovery in PaperUI.

Thanks Ondrej

Houdinain commented 5 years ago

Hi Ondrej,

Sorry for the delay. How is published data available for a thing ? (= is there a way to hack the ElectricitySensor state ?) Hereafter is the debug log of the discovery of one radiator :

2019-03-03 15:42:56.872 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - Starting scanning for things... 2019-03-03 15:42:57.276 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - url: io://1213-3871-7713/10656570#1 2019-03-03 15:42:57.276 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - Detected a/an onoffheatingsystem - label: Salon oid: accebd24-8b4b-494f-be97-01ce96a76207 2019-03-03 15:42:57.277 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - url: io://1213-3871-7713/10656570#2 2019-03-03 15:42:57.278 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - Detected a/an temperaturesensor - label: Salon-1 oid: fec50db3-37f1-4ff8-bc10-310d62de7a3b 2019-03-03 15:42:57.278 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - url: io://1213-3871-7713/10656570#3 2019-03-03 15:42:57.278 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - Detected a/an contactsensor - label: Salon-2 oid: 2ea27760-9888-40d8-97d2-9828ac6bd90c 2019-03-03 15:42:57.279 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - url: io://1213-3871-7713/10656570#4 2019-03-03 15:42:57.279 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - Detected a/an occupancysensor - label: Salon-3 oid: c6a6e3a1-c4e7-48bf-98e8-112921273d7e 2019-03-03 15:42:57.280 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - url: io://1213-3871-7713/10656570#5 2019-03-03 15:42:57.281 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Detected a new unsupported device: ElectricitySensor 2019-03-03 15:42:57.281 [INFO ] [very.SomfyTahomaItemDiscoveryService] - If you want to add the support, please create a new issue and attach the information below 2019-03-03 15:42:57.281 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Supported commands: { } 2019-03-03 15:42:57.281 [WARN ] [very.SomfyTahomaItemDiscoveryService] - Device states: {name='core:StatusState', type=3, value=available}

There are not many inputs other than "it's an onoffheatingsystem", maybe it's the gateway that sends it that way. I'll try with TRACE or ALL (not now because whenever I restart openhab the Somfy servers reject the login and I cannot command the radiators and rollershutters for the first few hours...)

By the way, I see that the remote I got with the tahoma box (https://shop.somfy.fi/media/catalog/product/cache/14/image/460x450/9df78eab33525d08d6e5fb8d27136e95/s/o/somfy_10931.jpg) is not recognized either by the binding :

2019-03-03 15:42:57.308 [DEBUG] [very.SomfyTahomaItemDiscoveryService] - url: rtds://1213-3871-7713/189542 2019-03-03 15:42:57.308 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Detected a new unsupported device: RemoteController 2019-03-03 15:42:57.308 [INFO ] [very.SomfyTahomaItemDiscoveryService] - If you want to add the support, please create a new issue and attach the information below 2019-03-03 15:42:57.308 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Supported commands: { } 2019-03-03 15:42:57.308 [WARN ] [very.SomfyTahomaItemDiscoveryService] - Device states: {name='rtds:ControllerOriginatorState', type=1, value=2.0} {name='rtds:ControllerSensingState', type=3, value=KO} {name='rtds:ControllerBatteryState', type=3, value=OK} {name='rtds:ControllerOrderTypeState', type=3, value=off}

Colin.

Houdinain commented 5 years ago

PS : I monkey pushed the buttons of the remote, here is the output if it's interesting :

Upper left button 2019-03-03 18:07:16.050 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device rtds://1213-3871-7713/189542 : [{name='rtds:ControllerOrderTypeState', type=0, value=onZ1}]

Upper right button 2019-03-03 18:10:16.369 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device rtds://1213-3871-7713/189542 : [{name='rtds:ControllerOrderTypeState', type=0, value=onZ2}]

Upper middle button doesn't seem to do anything (even the emission led on the remote doesn't light up)

Lower left button 2019-03-03 18:08:16.160 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device internal://1213-3871-7713/alarm/0 : [{name='internal:TargetAlarmModeState', type=0, value=total}] 2019-03-03 18:08:16.160 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device rtds://1213-3871-7713/189542 : [{name='rtds:ControllerOrderTypeState', type=0, value=onZ1-2-3}] 2019-03-03 18:08:16.160 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device internal://1213-3871-7713/alarm/0 : [{name='internal:CurrentAlarmModeState', type=0, value=total}]

Lower right button 2019-03-03 18:09:16.267 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device internal://1213-3871-7713/alarm/0 : [{name='internal:TargetAlarmModeState', type=0, value=off}, {name='internal:CurrentAlarmModeState', type=0, value=off}] 2019-03-03 18:09:16.267 [DEBUG] [oma.handler.SomfyTahomaBridgeHandler] - States for device rtds://1213-3871-7713/189542 : [{name='rtds:ControllerOrderTypeState', type=0, value=off}]

Houdinain commented 5 years ago

And the radiator is probably mismatched because the command channel is a TARGET_TEMPERATURE = "target_temperature" not a COMMAND_SET_HEATINGLEVEL = "setHeatingLevel" as expected in https://github.com/octa22/openhab2-addons/blob/6d3adca5fd5eb07402ef9eb1c59ec5c0bfb456ad/addons/binding/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/discovery/SomfyTahomaItemDiscoveryService.java#L252

octa22 commented 5 years ago

Hi, thanks for the log. Your HeatingSystem is most probably combination of the existing two I've encoutered so far. Apparently it has setHeatingLevel command in parallel with setting the target temperature feature. Could you please test this version https://www.dropbox.com/s/milfiftoww77p1e/org.openhab.binding.somfytahoma-2.5.0-SNAPSHOT.jar?dl=1 and do an autodiscovery? It should log more details about yout HeatingSystem, so the log is welcomed. Maybe I'll introduce a third HeatingSystem which will combine the two former ones...

Regarding the RemoteController - sorry, but I am ignoring this device for now. There is a lot of remote controllers which behave a lot differently and currently I am unable to add them as device :-(

Thank you. Ondrej

Houdinain commented 5 years ago

Yes, the radiators can also receive Comfort, Eco, ... orders, but setting the temperature with 0.5°C precision is more flexible so we just use the "basic" command. No problem for the remote, the pictograms are too specific to alarms anyway, so we ould not have used it regulary, it would have just been a way to have 4 more buttons to command things without buying another cheap remote.

Wow, that's a lot of commands and statuses...

2019-03-03 19:54:41.954 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Supported commands: { cancelHeatingLevel (params: 1); delayedStopIdentify (params: 1); getName (params: 0); identify (params: 0); off (params: 0); refreshComfortTemperature (params: 0); refreshDerogatedTargetTemperature (params: 0); refreshEcoTemperature (params: 0); refreshHeatingLevel (params: 0); refreshIdentifier (params: 0); refreshManufacturerName (params: 0); refreshMaximumHeatingTargetTemperature (params: 0); refreshMaximumTargetTemperature (params: 0); refreshOperatingMode (params: 0); refreshTargetTemperature (params: 0); refreshTemperature (params: 0); refreshTimeProgram (params: 0); setComfortTemperature (params: 1); setDerogatedTargetTemperature (params: 1); setEcoTemperature (params: 1); setHeatingLevel (params: 1); setHeatingLevelWithTimer (params: 2); setHolidays (params: 1); setHolidaysTargetTemperature (params: 1); setName (params: 1); setOccupancyActivation (params: 1); setOpenWindowDetectionActivation (params: 1); setOperatingMode (params: 1); setPreviousTargetTemperature (params: 1); setSchedulingType (params: 1); setTargetTemperature (params: 1); setTimeProgram (params: 1); startIdentify (params: 0); stopIdentify (params: 0); wink (params: 1); refreshAutoProgram (params: 0); refreshControllerAddress (params: 0); refreshNativeFunctionalLevel (params: 0); refreshSetpointLoweringTemperatureInProgMode (params: 0); setHeatingLevelForTrigger (params: 1); setSetpointLoweringTemperatureInProgMode (params: 1); setTwinningExit (params: 1); } 2019-03-03 19:54:41.955 [INFO ] [very.SomfyTahomaItemDiscoveryService] - Device states: {name='core:NameState', type=3, value=cuisine} {name='core:VersionState', type=3, value=2d202020ffffff240000} {name='io:TargetHeatingLevelState', type=3, value=comfort} {name='core:OnOffState', type=3, value=on} {name='core:StatusState', type=3, value=available} {name='core:RSSILevelState', type=2, value=80.0} {name='core:IdentifierState', type=3, value=00000000} {name='io:MaximumHeatingLevelState', type=3, value=unknown} {name='io:TimerForTransitoryStateState', type=1, value=65535.0} {name='core:ComfortRoomTemperatureState', type=1, value=17.0} {name='core:EcoRoomTemperatureState', type=2, value=3.5} {name='core:OperatingModeState', type=3, value=basic} {name='core:OccupancyActivationState', type=3, value=inactive} {name='core:MaximumTargetTemperatureState', type=2, value=28.0} {name='core:MaximumHeatingTargetTemperatureState', type=2, value=28.0} {name='core:TargetTemperatureState', type=2, value=14.0} {name='io:SetpointLoweringTemperatureInProgModeState', type=2, value=3.5} {name='core:OpenWindowDetectionActivationState', type=3, value=inactive} {name='io:InternalExternalSchedulingTypeState', type=3, value=external} {name='core:ManufacturerNameState', type=3, value=Thermor} {name='core:DerogatedTargetTemperatureState', type=2, value=0.0} {name='io:NativeFunctionalLevelState', type=3, value=Top} {name='io:ControllerAddressState', type=1, value=1.4059533E7} {name='core:TimeProgramState', type=10, value=[{monday=[{start=05:00, end=09:00}, {start=17:00, end=23:00}, {start=00:00, end=00:00}]}, {tuesday=[{start=05:00, end=09:00}, {start=17:00, end=23:00}, {start=00:00, end=00:00}]}, {wednesday=[{start=05:00, end=09:00}, {start=17:00, end=23:00}, {start=00:00, end=00:00}]}, {thursday=[{start=05:00, end=09:00}, {start=17:00, end=23:00}, {start=00:00, end=00:00}]}, {friday=[{start=05:00, end=09:00}, {start=17:00, end=23:00}, {start=00:00, end=00:00}]}, {saturday=[{start=05:00, end=23:00}, {start=00:00, end=00:00}, {start=00:00, end=00:00}]}, {sunday=[{start=05:00, end=23:00}, {start=00:00, end=00:00}, {start=00:00, end=00:00}]}]}

Colin.

octa22 commented 5 years ago

Thanks,

this is great! I've added a new thing Thermor Heating System, which is a heating system with one channel for setting target heating level and second channel for setting target temperature. If you want I can add any channel from above statuses or commands...just let me know You can test it :-) https://www.dropbox.com/s/milfiftoww77p1e/org.openhab.binding.somfytahoma-2.5.0-SNAPSHOT.jar?dl=1

Please, let me know if it's worth merging with master... Thanks Ondrej

Houdinain commented 5 years ago

Thanks for the quick update !

I'll test it during this week and will get back to you next weekend. (It correctly detects a "thermorheatingsystem" already) I guess I'm not the only one with this kind of radiators (but I may be the only one that buys them without using their not-so-good app), so if the new type integrates correctly in the binding, why not. Maybe we can find a more generic name for this new type, Thermor isn't the only one making these, Atlantic has their "Maradja", and I guess Sauter being the same brand has too.

Colin.

Houdinain commented 5 years ago

For the ElectricitySensor, is there really no way to read "hidden" statuses ? I found this :https://github.com/dubocr/homebridge-tahoma/blob/master/accessories/ElectricitySensor.js and the statuses seem to be named 'core:ElectricEnergyConsumptionState' and 'core:ElectricPowerConsumptionState', but I don't see a mention of things being available only on the Cozytouch and not on the Tahoma. The Cozytouch bridge is just 99€ at the hardware store next to where I work (https://www.leroymerlin.fr/v3/p/produits/box-connectee-cozytouch-sauter-e1401181289#), I could buy one if you're interested.

Colin.

octa22 commented 5 years ago

How many ElectricitySensors are you using? Or is it only virtual device provided by the Thermor heating? I have seen logs where some ElectricitySensors were having this power consumption feature exposed to tahoma and some were lacking. Some user had combination of both types - some reporting, some not reporting, some were reporting even tariffs So far I have faced 4 types od ElectricitySensors... Do you see the power consumption in http://tahomalink.com portal? If so, I can most definitely read it too. Thanks Ondrej

Houdinain commented 5 years ago

The sensor is integrated in the radiator, as the temperature sensor, presence detection etc. I can't see the electric consumption in the somfy portal, but I can't see the temperature sensor, occupancy sensor and opened window sensor either (I can only send commands and see the current applied command), and these are correctly found during detection, so I didn't see that as a sign of impossibility :)

Do you have a PR somewhere where you add a new somfytahoma type, maybe I can try adding my sensor and testing things on my own, without asking you everytime ?

Colin.

octa22 commented 5 years ago

hi,

sorry for delayed answer. The latest version containing the Thermor Heating System is here: https://github.com/octa22/openhab2-addons/tree/somfytahoma-binding-temp

Ondrej

st 6. 3. 2019 v 10:52 odesílatel Houdinain notifications@github.com napsal:

The sensor is integrated in the radiator, as the temperature sensor, presence detection etc. I can't see the electric consumption in the somfy portal, but I can't see the temperature sensor, occupancy sensor and opened window sensor either (I can only send commands and see the current applied command), and these are correctly found during detection, so I didn't see that as a sign of impossibility :)

Do you have a PR somewhere where you add a new somfytahoma type, maybe I can try adding my sensor and testing things on my own, without asking you everytime ?

Colin.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openhab/openhab2-addons/issues/4389#issuecomment-470042475, or mute the thread https://github.com/notifications/unsubscribe-auth/AT8HdwG4qupG-Ey4VmExZstivnW__uRWks5vT4_mgaJpZM4ZVSwc .

Houdinain commented 5 years ago

Hi, discovery and target temperature setting work perfectly with the jar you provided. (the heating level command is odd, if I send frostprotection if overrides previous settings and work as expected, but every other command does nothing, but I guess this comes from the interface between the radiators and the tahoma and what the tahoma allows from its API)

Thanks for the Electricity sensor, I'll try some things and will get back to you. This is what is sent for this item during discovery : {"creationTime":1543656147000, "lastUpdateTime":1543656147000, "label":"Salon-4", "deviceURL":"io://1213-3871-7713/10656570#5", "shortcut":false, "controllableName":"io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor",

"definition":{"commands":[], "states":[{"values":["available","unavailable"],"type":"DiscreteState","qualifiedName":"core:StatusState"}], "dataProperties":[], "widgetName":"CumulativeElectricPowerConsumptionSensor", "uiClass":"ElectricitySensor", "qualifiedName":"io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor", "type":"SENSOR"},

"states":[ {"name":"core:StatusState","type":3,"value":"available"}],

"attributes":[ {"name":"core:PowerSourceType","type":3,"value":"mainSupply"}, {"name":"core:MeasuredValueType","type":3,"value":"core:ElectricalEnergyInWh"}],

"available":true, "enabled":true, "placeOID":"e4473432-59d3-47a0-aec4-27fbc8af08f0", "widget":"CumulativeElectricPowerConsumptionSensor", "type":2, "oid":"d0e6748b-55e6-4a10-b39b-93ec67e642aa", "uiClass":"ElectricitySensor"},

I'll try adding it anyway to see what I can receive.

Colin.

octa22 commented 5 years ago

Hi Colin,

thanks for the feedback on Thermor HeatingSystem. Most probably the Thermor heating uses other states (besides the frostprotection) that differ from the ones currently used for onoff HeatingSystem thing. If you identify them, I can add them as well.

Regarding the ElectricitySensor this is awesome: "attributes":[ {"name":"core:PowerSourceType","type":3,"value":"mainSupply"}, {"name":"core:MeasuredValueType","type":3,"value":"core:ElectricalEnergyInWh"}],

it seems, that besides the states there are attributes which releals other values! Maybe you could try to add a new channel which gets state from "core:ElectricalEnergyInWh" (look at the ElectricitySensor handler and as well update the discovery so even the ElectricitySensor with only one state "core:StatusState" is discovered as supported - currently these ElectricitySensors are ignored)

If you need help, just let me know! Thanks, Ondrej

po 11. 3. 2019 v 2:12 odesílatel Houdinain notifications@github.com napsal:

Hi, discovery and target temperature setting work perfectly with the jar you provided. (the heating level command is odd, if I send frostprotection if overrides previous settings and work as expected, but every other command does nothing, but I guess this comes from the interface between the radiators and the tahoma and what the tahoma allows from its API)

Thanks for the Electricity sensor, I'll try some things and will get back to you. This is what is sent for this item during discovery : {"creationTime":1543656147000, "lastUpdateTime":1543656147000, "label":"Salon-4", "deviceURL":"io://1213-3871-7713/10656570#5", "shortcut":false,

"controllableName":"io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor",

"definition":{"commands":[],

"states":[{"values":["available","unavailable"],"type":"DiscreteState","qualifiedName":"core:StatusState"}], "dataProperties":[], "widgetName":"CumulativeElectricPowerConsumptionSensor", "uiClass":"ElectricitySensor",

"qualifiedName":"io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor", "type":"SENSOR"},

"states":[ {"name":"core:StatusState","type":3,"value":"available"}],

"attributes":[ {"name":"core:PowerSourceType","type":3,"value":"mainSupply"},

{"name":"core:MeasuredValueType","type":3,"value":"core:ElectricalEnergyInWh"}],

"available":true, "enabled":true, "placeOID":"e4473432-59d3-47a0-aec4-27fbc8af08f0", "widget":"CumulativeElectricPowerConsumptionSensor", "type":2, "oid":"d0e6748b-55e6-4a10-b39b-93ec67e642aa", "uiClass":"ElectricitySensor"},

I'll try adding it anyway to see what I can receive.

Colin.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openhab/openhab2-addons/issues/4389#issuecomment-471374093, or mute the thread https://github.com/notifications/unsubscribe-auth/AT8Hdy5S2qF2qisVFlwgnn_3K26a-iNHks5vVa1pgaJpZM4ZVSwc .

Houdinain commented 5 years ago

I'm getting used to the dev environment, it's neatly organized, I love that.

This is what I get from the getStates call on the ElectricitySensor device : {"devices":[{"label":"IO (10656570#5)","deviceURL":"io://1213-3871-7713/10656570#5","shortcut":false,"states":[{"name":"core:StatusState","type":3,"value":"available"}],"available":false,"enabled":false,"type":1}],"events":[]} It does not show up in the getevents call either. I'll let debug output on for the day, maybe I'll get lucky.

I took another look to Romain Duboc's implementation now that I'm more familiar with yours, he seems to request data differently : https://github.com/dubocr/homebridge-tahoma/blob/41fac6195ca34d443c5261a112aa96670733f028/overkiz-api.js lines 153, 288 and 298 for example. I'll try these requests to see what I get.

Thanks again for your help, Colin.