homematicip-rest-api icon indicating copy to clipboard operation
homematicip-rest-api copied to clipboard

Hmip switch: turn_on event: HmipWrongStatusError(400)

Open Kiko0132 opened this issue 3 years ago • 16 comments

Hope someone can help: Run HA on a RPI with the homematic ip cloud integrations.

Since 2 weeks I am no longer able to turn on / off the switch. Interestingly the manuel turn on / off at the device updates the status in HA. But the turn on event in HA gives following error: HmipWrongStatusError(400) and generates this log:

Logger: homeassistant.components.websocket_api.http.connection Source: components/homematicip_cloud/switch.py:108 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 21:07:48 (2 occurrences) Last logged: 21:08:15

[547992883984] HmipWrongHttpStatusError(400) Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 185, in handle_call_service await hass.services.async_call( File “/usr/src/homeassistant/homeassistant/core.py”, line 1491, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1526, in _execute_service await handler.job.target(service_call) File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 213, in handle_service await self.hass.helpers.service.entity_service_call( File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 658, in entity_service_call future.result() # pop exception if have File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 830, in async_request_call await coro File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 695, in _handle_entity_call await result File “/usr/src/homeassistant/homeassistant/components/homematicip_cloud/switch.py”, line 108, in async_turn_on await self._device.turn_on(self._channel) File “/usr/local/lib/python3.9/site-packages/homematicip/aio/device.py”, line 42, in turn_on return await self.set_switch_state(True, channelIndex) File “/usr/local/lib/python3.9/site-packages/homematicip/aio/device.py”, line 38, in set_switch_state return await self._connection.api_call(url, data) File “/usr/local/lib/python3.9/site-packages/homematicip/aio/connection.py”, line 97, in api_call raise HmipWrongHttpStatusError(result.status) homematicip.base.base_connection.HmipWrongHttpStatusError: HmipWrongHttpStatusError(400)

Kiko0132 avatar Nov 18 '21 21:11 Kiko0132

Is this still a problem?

hahn-th avatar Aug 10 '22 09:08 hahn-th

Is this still a problem? Yes no Solution.

dtdeg avatar Aug 10 '22 10:08 dtdeg

Do you have more devices active in homematic-ip integration? Are they working properly?

hahn-th avatar Aug 10 '22 10:08 hahn-th

Do you have more devices active in homematic-ip integration? Are they working properly?

yes more devices. mainly to control thermostats. these function all work ok. but not with this "turn on switch" function. Im using the hpmiob for switch on the relays in it. I think its just something small like the type of parameter in the methods used. I would like to help with troubleshoot. let me know.

dtdeg avatar Aug 10 '22 11:08 dtdeg

You could download this lib directly and try to turn on and off via the CLI (hmip_cli.py). Let me know, if i can help you. Maybe via discord if you have agonist#6159

hahn-th avatar Aug 10 '22 13:08 hahn-th

ok i've downloaded the lib and generate a new key. i can talk to the AP but dont get the paremeters. i can list my devices etc but how to turn on for example: hmip_cli.py --list-groups

HOT_WATER HOT_WATER on(False) onTime(20.0) profileMode(MANUAL)

thought HOT_WATER HOT_WATER was a variable i could use as hmip_cli.py --turn-on HOT_WATER HOT_WATER

dtdeg avatar Aug 10 '22 14:08 dtdeg

with --list-devices you can list all your devices. copy the ID 37000000.... python hmip_cli.py -d YOUR_ID --turn-on i think. Give it a try :)

hahn-th avatar Aug 10 '22 15:08 hahn-th

Thanks. Doenst work with device id nor group-ids. Im trying the hpmiob device. I think i need to specify the channel. What parameters are used in the hass add on to talk to the channels?

Verzonden vanuit Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 voor Windows

Van: @.> Verzonden: woensdag 10 augustus 2022 17:24 Aan: @.> CC: @.>; @.> Onderwerp: Re: [hahn-th/homematicip-rest-api] Hmip switch: turn_on event: HmipWrongStatusError(400) (Issue #425)

with --list-devices you can list all your devices. copy the ID 37000000.... python hmip_cli.py -d YOUR_ID --turn-on i think. Give it a try :)

— Reply to this email directly, view it on GitHubhttps://github.com/hahn-th/homematicip-rest-api/issues/425#issuecomment-1210866047, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWNVKUTVIOKKMXOC7FKN55DVYPCTXANCNFSM5IKTTACQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dtdeg avatar Aug 10 '22 18:08 dtdeg

you can find it out:

  1. dump your configuration with cli parameter --dump-configuration
  2. find your device inside the output
  3. search for functionalChannel "SWITCH_CHANNEL". There you have the index.
  4. make your CLI call from above with --channel x where x is the index from your config. Depending on your device (i cant find hpmiob) you maybe have multiple switch-channels.

I dont know which channel is used in HASS

hahn-th avatar Aug 10 '22 19:08 hahn-th

Thanks;

Doenst work. I’ve tryed the following command combinations but no luck;

python3 hmip_cli.py -d 3014F --turn-on --channel eafe3231 or python3 hmip_cli.py -d 3014F --turn-on --channel 2

and different orders. Info used from config dump below

"deviceId": "3014F", "functionalChannelType": "SWITCH_CHANNEL", "groupIndex": 2, "groups": [ "eafe3231 ", "4612da13 " ], "index": 2, "internalLinkConfiguration": null, "label": "Warmwaterbehoefte", "on": false, "powerUpSwitchState": "PERMANENT_OFF", "profileMode": "MANUAL", "supportedOptionalFeatures": { "IOptionalFeatureInternalLinkConfiguration": false, "IOptionalFeaturePowerUpSwitchState": false

Verzonden vanuit Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 voor Windows

Van: @.> Verzonden: woensdag 10 augustus 2022 21:25 Aan: @.> CC: @.>; @.> Onderwerp: Re: [hahn-th/homematicip-rest-api] Hmip switch: turn_on event: HmipWrongStatusError(400) (Issue #425)

you can find it out:

  1. dump your configuration with cli parameter --dump-configuration
  2. find your device inside the output
  3. search for functionalChannel "SWITCH_CHANNEL". There you have the index.
  4. make your CLI call from above with --channel x where x is the index from your config. Depending on your device (i cant find hpmiob) you maybe have multiple switch-channels.

I dont know which channel is used in HASS

— Reply to this email directly, view it on GitHubhttps://github.com/hahn-th/homematicip-rest-api/issues/425#issuecomment-1211163895, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWNVKUWS4IL4THZUAINZESTVYP6ZXANCNFSM5IKTTACQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dtdeg avatar Aug 10 '22 20:08 dtdeg

are these really your ids? mine are looking quite different with 24 digits. you can use the param --debug-level 10 to get informations about whats going on. post it here pls.

hahn-th avatar Aug 10 '22 21:08 hahn-th

no i anonymous them. With the debug i get the same response as in the hass integration:

2022-08-12 16:58:15,070 - homematicip.connection - DEBUG - _restcall path(https://srv30.homematic.com:6969/hmip/device/control/setSwitchState) body({"channelIndex": 5, "deviceId": "3014F7", "on": true}) 2022-08-12 16:58:15,072 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): srv30.homematic.com:6969 2022-08-12 16:58:15,244 - urllib3.connectionpool - DEBUG - https://srv30.homematic.com:6969 "POST /hmip/device/control/setSwitchState HTTP/1.1" 400 37 2022-08-12 16:58:15,247 - homematicip.connection - DEBUG - _restcall result: Errorcode=400 content({'errorCode': 'FEATURE_NOT_SUPPORTED'})

python3 hmip_cli.py -d 3014F711A0000715699E15EE -g eafe3231-5efb-453a --turn-on --debug-level 10

config output:

3014F": { "availableFirmwareVersion": "2.0.10", "connectionType": "HMIP_RF", "firmwareVersion": "2.0.10", "firmwareVersionInteger": 131082, "functionalChannels": { "0": { "busConfigMismatch": null, "coProFaulty": false, "coProRestartNeeded": false, "coProUpdateFailure": false, "configPending": false, "deviceCommunicationError": null, "deviceDriveError": null, "deviceDriveModeError": null, "deviceId": "3014F", "deviceOverheated": false, "deviceOverloaded": false, "devicePowerFailureDetected": false, "deviceUndervoltage": false, "displayContrast": null, "dutyCycle": false, "functionalChannelType": "DEVICE_BASE", "groupIndex": 0, "groups": [ "069a738f-16ce-4ab4-" ], "index": 0, "label": "", "lockJammed": null, "lowBat": null, "mountingOrientation": null, "multicastRoutingEnabled": false, "particulateMatterSensorCommunicationError": null, "particulateMatterSensorError": null, "powerShortCircuit": null, "profilePeriodLimitReached": null, "routerModuleEnabled": false, "routerModuleSupported": false, "rssiDeviceValue": -27, "rssiPeerValue": -25, "shortCircuitDataLine": null, "supportedOptionalFeatures": { "IFeatureBusConfigMismatch": false, "IFeatureDeviceCoProError": false, "IFeatureDeviceCoProRestart": false, "IFeatureDeviceCoProUpdate": false, "IFeatureDeviceCommunicationError": false, "IFeatureDeviceDriveError": false, "IFeatureDeviceDriveModeError": false, "IFeatureDeviceIdentify": false, "IFeatureDeviceOverheated": false, "IFeatureDeviceOverloaded": false, "IFeatureDeviceParticulateMatterSensorCommunicationError": false, "IFeatureDeviceParticulateMatterSensorError": false, "IFeatureDevicePowerFailure": false, "IFeatureDeviceTemperatureHumiditySensorCommunicationError": false, "IFeatureDeviceTemperatureHumiditySensorError": false, "IFeatureDeviceTemperatureOutOfRange": false, "IFeatureDeviceUndervoltage": false, "IFeatureMulticastRouter": false, "IFeaturePowerShortCircuit": false, "IFeatureProfilePeriodLimit": true, "IFeatureRssiValue": true, "IFeatureShortCircuitDataLine": false, "IOptionalFeatureDeviceErrorLockJammed": false, "IOptionalFeatureDisplayContrast": false, "IOptionalFeatureDutyCycle": true, "IOptionalFeatureLowBat": false, "IOptionalFeatureMountingOrientation": false }, "temperatureHumiditySensorCommunicationError": null, "temperatureHumiditySensorError": null, "temperatureOutOfRange": false, "unreach": false }, "1": { "deviceId": "3014F", "functionalChannelType": "SWITCH_CHANNEL", "groupIndex": 1, "groups": [], "index": 1, "internalLinkConfiguration": null, "label": "", "on": false, "powerUpSwitchState": "PERMANENT_OFF", "profileMode": "AUTOMATIC", "supportedOptionalFeatures": { "IOptionalFeatureInternalLinkConfiguration": false, "IOptionalFeaturePowerUpSwitchState": false }, "userDesiredProfileMode": "AUTOMATIC" }, "2": { "deviceId": "3014F", "functionalChannelType": "SWITCH_CHANNEL", "groupIndex": 2, "groups": [ "eafe3231-5efb-4", "4612da13-f383-4" ], "index": 2, "internalLinkConfiguration": null, "label": "Warmwaterbehoefte", "on": false, "powerUpSwitchState": "PERMANENT_OFF", "profileMode": "MANUAL", "supportedOptionalFeatures": { "IOptionalFeatureInternalLinkConfiguration": false, "IOptionalFeaturePowerUpSwitchState": false }, "userDesiredProfileMode": "MANUAL" }, "3": { "deviceId": "3014F", "digitalInputMode": "NORMALLY_OPEN", "functionalChannelType": "GENERIC_INPUT_CHANNEL", "groupIndex": 3, "groups": [], "index": 3, "label": "", "supportedOptionalFeatures": { "IOptionalFeatureDigitalInputMode": true } }, "4": { "deviceId": "3014F", "digitalInputMode": "NORMALLY_OPEN", "functionalChannelType": "GENERIC_INPUT_CHANNEL", "groupIndex": 4, "groups": [], "index": 4, "label": "", "supportedOptionalFeatures": { "IOptionalFeatureDigitalInputMode": true } }, "5": { "analogOutputLevel": 0.0, "deviceId": "3014F", "functionalChannelType": "ANALOG_OUTPUT_CHANNEL", "groupIndex": 0, "groups": [], "index": 5, "label": "" } }, "homeId": "d3f14b2f-1257-", "id": "3014F", "label": "Multi IO box", "lastStatusUpdate": 1660309431158, "liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED", "manufacturerCode": 1, "modelId": 283, "modelType": "HmIP-MIOB", "oem": "eQ-3", "permanentlyReachable": true, "serializedGlobalTradeItemNumber": "3014F", "type": "MULTI_IO_BOX", "updateState": "UP_TO_DATE" },


Van: hahn-th @.> Verzonden: woensdag 10 augustus 2022 23:11 Aan: hahn-th/homematicip-rest-api @.> CC: dtdeg @.>; Manual @.> Onderwerp: Re: [hahn-th/homematicip-rest-api] Hmip switch: turn_on event: HmipWrongStatusError(400) (Issue #425)

are these really your ids? mine are looking quite different with 24 digits. you can use the param --debug-level 10 to get informations about whats going on. post it here pls.

— Reply to this email directly, view it on GitHubhttps://github.com/hahn-th/homematicip-rest-api/issues/425#issuecomment-1211278326, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWNVKUTAUDPQ7Z7IO6Z4WZ3VYQLITANCNFSM5IKTTACQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dtdeg avatar Aug 12 '22 15:08 dtdeg

Okay i have seen, you try to control a device and a group. That does not work. Also you have to address channel 1 or channel 2. Please call: python3 hmip_cli.py -d 3014F711A0000715699E15EE --turn-on --debug-level 10 --channel 1 python3 hmip_cli.py -d 3014F711A0000715699E15EE --turn-on --debug-level 10 --channel 2

And post the output here. You can also try --turn-off.

hahn-th avatar Aug 12 '22 18:08 hahn-th

2022-08-13 10:03:09,929 - homematicip.connection - DEBUG - _restcall path(https://srv30.homematic.com:6969/hmip/device/control/setSwitchState) body({"channelIndex": "1", "deviceId": "3014F711A0000715699E15EE", "on": true}) 2022-08-13 10:03:09,932 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): srv30.homematic.com:6969 2022-08-13 10:03:10,249 - urllib3.connectionpool - DEBUG - https://srv30.homematic.com:6969 "POST /hmip/device/control/setSwitchState HTTP/1.1" 400 37 2022-08-13 10:03:10,253 - homematicip.connection - DEBUG - _restcall result: Errorcode=400 content({'errorCode': 'FEATURE_NOT_SUPPORTED'})

same result. tryed different channels but same result also. Looks like the api expects other value for turning on. How can we get the api available calls ? In the list events i dont get allot of usable info:

python3 hmip_cli.py --list-events EventType: GROUP_CHANGED Data: HOT_WATER HOT_WATER on(True) onTime(20.0) profileMode(MANUAL) EventType: DEVICE_CHANGED Data: HmIP-MIOB Multi IO box lowBat(None) unreach(False) rssiDeviceValue(-27) rssiPeerValue(-25) configPending(False) dutyCycle(False) on(False) profileMode(AUTOMATIC) userDesiredProfileMode(AUTOMATIC) analogOutputLevel(0.0) EventType: GROUP_CHANGED Data: HOT_WATER HOT_WATER on(False) onTime(20.0) profileMode(MANUAL) EventType: GROUP_CHANGED Data: META Meterkast EventType: GROUP_CHANGED Data: HEATING Meterkast windowOpenTemperature(12.0) setPointTemperature(None) windowState(None) motionDetected(30.0) sabotage(5.0) cooling(None) partyMode(False) controlMode(AUTOMATIC) actualTemperature(None) valvePosition(None) EventType: DEVICE_CHANGED Data: HmIP-MIOB Multi IO box lowBat(None) unreach(False) rssiDeviceValue(-27) rssiPeerValue(-25) configPending(False) dutyCycle(False) on(False) profileMode(AUTOMATIC) userDesiredProfileMode(AUTOMATIC) analogOutputLevel(0.0) EventType: GROUP_CHANGED Data: HOT_WATER HOT_WATER on(True) onTime(20.0) profileMode(MANUAL) EventType: GROUP_CHANGED Data: META Meterkast EventType: GROUP_CHANGED Data: HEATING Meterkast windowOpenTemperature(12.0) setPointTemperature(None) windowState(None) motionDetected(30.0) sabotage(5.0) cooling(None) partyMode(False) controlMode(AUTOMATIC) actualTemperature(None) valvePosition(None) EventType: GROUP_CHANGED Data: HOT_WATER HOT_WATER on(False) onTime(20.0) profileMode(MANUAL) EventType: DEVICE_CHANGED Data: HmIP-MIOB Multi IO box lowBat(None) unreach(False) rssiDeviceValue(-27) rssiPeerValue(-24) configPending(False) dutyCycle(False) on(False) profileMode(AUTOMATIC) userDesiredProfileMode(AUTOMATIC) analogOutputLevel(0.0) EventType: GROUP_CHANGED Data: HOT_WATER HOT_WATER on(True) onTime(20.0) profileMode(MANUAL) EventType: GROUP_CHANGED Data: META Meterkast EventType: GROUP_CHANGED Data: HEATING Meterkast windowOpenTemperature(12.0) setPointTemperature(None) windowState(None) motionDetected(30.0) sabotage(5.0) cooling(None) partyMode(False) controlMode(AUTOMATIC) actualTemperature(None) valvePosition(None) EventType: DEVICE_CHANGED Data: HmIP-MIOB Multi IO box lowBat(None) unreach(False) rssiDeviceValue(-27) rssiPeerValue(-24) configPending(False) dutyCycle(False) on(False) profileMode(AUTOMATIC) userDesiredProfileMode(AUTOMATIC) analogOutputLevel(0.0) EventType: GROUP_CHANGED Data: HOT_WATER HOT_WATER on(False) onTime(20.0) profileMode(MANUAL) EventType: GROUP_CHANGED Data: META Meterkast EventType: GROUP_CHANGED Data: HEATING Meterkast windowOpenTemperature(12.0) setPointTemperature(None) windowState(None) motionDetected(30.0) sabotage(5.0) cooling(None) partyMode(False) controlMode(AUTOMATIC) actualTemperature(None) valvePosition(None)

Somehow i cant use the label or the ID from HOT_WATER to turn on the function. these are the group-ids from the device i know of:

Id: f48c6e16-8e7e-4884-9497-b275900b1671 - Type: HEATING_CHANGEOVER - Label: HEATING_CHANGEOVER Id: 80521d22-179a-491b-861b-8cf6ef44f204 - Type: HEATING_COOLING_DEMAND_BOILER - Label: HEATING_COOLING_DEMAND_BOILER Id: 3af99972-cda5-4ba4-87e9-b8d2262733b7 - Type: HEATING_COOLING_DEMAND_PUMP - Label: HEATING_COOLING_DEMAND_PUMP Id: 0ed73d32-a5a0-48a5-9511-d2b3589a2452 - Type: HEATING_DEHUMIDIFIER - Label: HEATING_DEHUMIDIFIER Id: 5008e20e-7e53-47eb-8e9a-82600e611d35 - Type: HEATING_EXTERNAL_CLOCK - Label: HEATING_EXTERNAL_CLOCK Id: 12c389c0-bb84-47d6-bb43-92afb9a5da89 - Type: HEATING_HUMIDITY_LIMITER - Label: HEATING_HUMIDITY_LIMITER Id: 22ff65f0-a3a2-47b4-9dae-97ecdbdeb667 - Type: HEATING_TEMPERATURE_LIMITER - Label: HEATING_TEMPERATURE_LIMITER Id: eafe3231-5efb-453a-b810-bef420bee7fb - Type: HOT_WATER - Label: HOT_WATER

Hot-water is the function in the app i can click to activate it. But they changed the activation call i think. How can we reverse engineer this ? The calls are https so cant see the data with packet captures...


Van: hahn-th @.> Verzonden: vrijdag 12 augustus 2022 20:02 Aan: hahn-th/homematicip-rest-api @.> CC: dtdeg @.>; Manual @.> Onderwerp: Re: [hahn-th/homematicip-rest-api] Hmip switch: turn_on event: HmipWrongStatusError(400) (Issue #425)

Okay i have seen, you try to manipulate a device and a group. That does not work. Also you have to address channel 1 or channel 2. Please call: python3 hmip_cli.py -d 3014F711A0000715699E15EE --turn-on --debug-level 10 --channel 1 python3 hmip_cli.py -d 3014F711A0000715699E15EE --turn-on --debug-level 10 --channel 2

And post the output here. You can also try --turn-off.

— Reply to this email directly, view it on GitHubhttps://github.com/hahn-th/homematicip-rest-api/issues/425#issuecomment-1213375107, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWNVKUWJUTJUJOFO6ODMGY3VY2GSXANCNFSM5IKTTACQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dtdeg avatar Aug 13 '22 08:08 dtdeg

You could use https://www.charlesproxy.com/documentation/using-charles/ssl-certificates Install it on your pc and setup your phone using your pc as proxy with the port.

Now you should be able to see the traffic. Maybe you could write down with time what you are doing and push the button in the app. Between different actions let pass some time so i can follow and clearly isolate what happens. You should see the post/get requests in the proxy.

Great, you are doing that! I have never tried this applicaton myself. If you are done you can send me an email with the data.

hahn-th avatar Aug 13 '22 10:08 hahn-th

ok i can try the man-in-the-middle trick. 'll let you know thanks.


Van: hahn-th @.> Verzonden: zaterdag 13 augustus 2022 12:01 Aan: hahn-th/homematicip-rest-api @.> CC: dtdeg @.>; Manual @.> Onderwerp: Re: [hahn-th/homematicip-rest-api] Hmip switch: turn_on event: HmipWrongStatusError(400) (Issue #425)

You could use https://www.charlesproxy.com/documentation/using-charles/ssl-certificates Install it on your pc and setup your phone using your pc as proxy with the port.

Now you should be able to see the traffic. Maybe you could write down with time what you are doing and push the button in the app. Between different actions let pass some time so i can follow and clearly isolate what happens.

Great, you are doing that! I have never tried this applicaton myself. After thatyou can send me an email with the data.

— Reply to this email directly, view it on GitHubhttps://github.com/hahn-th/homematicip-rest-api/issues/425#issuecomment-1214130854, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWNVKUUF5PRRNC4BKN3MZE3VY5W7LANCNFSM5IKTTACQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dtdeg avatar Aug 13 '22 10:08 dtdeg