Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for [Somfy Terrace Heater] (io:SimpleExteriorHeatingIOComponent) #161

Closed
mjhcdk opened this issue Jul 20, 2020 · 50 comments
Closed

Comments

@mjhcdk
Copy link

mjhcdk commented Jul 20, 2020

Device information

Somfy Terrace heaters module with 6 steps to set heating level. The device can be managed Connexoon io box and Somfy Terrace App, but is not revealed via Somfy API.

The requirements would be to read the state (on/off) and heat level of the device. Secondly, set the heating level from 0 -100 %. and power on/off.

Device details

I am not able to follow the instructions directly as I don't have access to Tahomalink Web gui, as I only have a Connexoon-io-box.
But the home-assistant.log reveals the following output. Hope this can make the device supported.
Please let me know if more information can be revealed in another approach.

thx in advance

io:SimpleExteriorHeatingIOComponent - ExteriorHeatingSystem - DimmerExteriorHeating 
 [{"commandName": "delayedStopIdentify", "nparams": 1}, {"commandName": "getLevel", "nparams": 0}, {"commandName": "getName", "nparams": 0}, {"commandName": "identify", "nparams": 0}, {"commandName": "off", "nparams": 0}, {"commandName": "on", "nparams": 0}, {"commandName": "setLevel", "nparams": 1}, {"commandName": "setName", "nparams": 1}, {"commandName": "startIdentify", "nparams": 0}, {"commandName": "stopIdentify", "nparams": 0}, {"commandName": "wink", "nparams": 1}, {"commandName": "pairOneWayController", "nparams": 2}, {"commandName": "unpairAllOneWayControllers", "nparams": 0}, {"commandName": "unpairOneWayController", "nparams": 2}], 
 [{"values": ["good", "low", "normal", "verylow"], "type": "DiscreteState", "qualifiedName": "core:DiscreteRSSILevelState"}, {"type": "ContinuousState", "qualifiedName": "core:LevelState"}, {"type": "DataState", "qualifiedName": "core:NameState"}, {"type": "ContinuousState", "qualifiedName": "core:PriorityLockTimerState"}, {"type": "ContinuousState", "qualifiedName": "core:RSSILevelState"}, {"values": ["available", "unavailable"], "type": "DiscreteState", "qualifiedName": "core:StatusState"}, {"values": ["comfortLevel1", "comfortLevel2", "comfortLevel3", "comfortLevel4", "environmentProtection", "humanProtection", "userLevel1", "userLevel2"], "type": "DiscreteState", "qualifiedName": "io:PriorityLockLevelState"}, {"values": ["LSC", "SAAC", "SFC", "UPS", "externalGateway", "localUser", "myself", "rain", "security", "temperature", "timer", "user", "wind"], "type": "DiscreteState", "qualifiedName": "io:PriorityLockOriginatorState"}]
@tetienne
Copy link
Collaborator

@vlebourl Perfect for your climate platform refactor ;)

{
  "commands": [
    {
      "commandName": "delayedStopIdentify",
      "nparams": 1
    },
    {
      "commandName": "getLevel",
      "nparams": 0
    },
    {
      "commandName": "getName",
      "nparams": 0
    },
    {
      "commandName": "identify",
      "nparams": 0
    },
    {
      "commandName": "off",
      "nparams": 0
    },
    {
      "commandName": "on",
      "nparams": 0
    },
    {
      "commandName": "setLevel",
      "nparams": 1
    },
    {
      "commandName": "setName",
      "nparams": 1
    },
    {
      "commandName": "startIdentify",
      "nparams": 0
    },
    {
      "commandName": "stopIdentify",
      "nparams": 0
    },
    {
      "commandName": "wink",
      "nparams": 1
    },
    {
      "commandName": "pairOneWayController",
      "nparams": 2
    },
    {
      "commandName": "unpairAllOneWayControllers",
      "nparams": 0
    },
    {
      "commandName": "unpairOneWayController",
      "nparams": 2
    }
  ],
  "states": [
    {
      "values": [
        "good",
        "low",
        "normal",
        "verylow"
      ],
      "type": "DiscreteState",
      "qualifiedName": "core:DiscreteRSSILevelState"
    },
    {
      "type": "ContinuousState",
      "qualifiedName": "core:LevelState"
    },
    {
      "type": "DataState",
      "qualifiedName": "core:NameState"
    },
    {
      "type": "ContinuousState",
      "qualifiedName": "core:PriorityLockTimerState"
    },
    {
      "type": "ContinuousState",
      "qualifiedName": "core:RSSILevelState"
    },
    {
      "values": [
        "available",
        "unavailable"
      ],
      "type": "DiscreteState",
      "qualifiedName": "core:StatusState"
    },
    {
      "values": [
        "comfortLevel1",
        "comfortLevel2",
        "comfortLevel3",
        "comfortLevel4",
        "environmentProtection",
        "humanProtection",
        "userLevel1",
        "userLevel2"
      ],
      "type": "DiscreteState",
      "qualifiedName": "io:PriorityLockLevelState"
    },
    {
      "values": [
        "LSC",
        "SAAC",
        "SFC",
        "UPS",
        "externalGateway",
        "localUser",
        "myself",
        "rain",
        "security",
        "temperature",
        "timer",
        "user",
        "wind"
      ],
      "type": "DiscreteState",
      "qualifiedName": "io:PriorityLockOriginatorState"
    }
  ],
  "dataProperties": [
    {
      "value": "500",
      "qualifiedName": "core:identifyInterval"
    }
  ],
  "widgetName": "DimmerExteriorHeating",
  "uiClass": "ExteriorHeatingSystem",
  "qualifiedName": "io:SimpleExteriorHeatingIOComponent",
  "type": "ACTUATOR"
}

@tetienne
Copy link
Collaborator

@mjhcdk You talk about a percent value, how this device works? In the output, I can see values like ComfortLevel1, ComfortLevel2. That's what you set?
Can you please provide a screenshot of the Connexoon UI when you manipulate this device?

@mjhcdk
Copy link
Author

mjhcdk commented Jul 20, 2020

For sure, there is actually just a simple slider with 6 fixed steps where first is off) and top is obviously full heat. The Procent level was based on my awkning fuctionality on base box.
Somfy-Terrace-app-heater

@vlebourl
Copy link
Collaborator

vlebourl commented Jul 21, 2020

I suppose we would need to use getLevel and setLevel. I'll try to add something that makes sense, and put some debug and attribute info to make sure we're on track, then clean it up after your testing. I'll keep you posted.

@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

very appreciated - Am I ready to perform some testing and troubleshooting

vlebourl added a commit that referenced this issue Jul 21, 2020
@vlebourl
Copy link
Collaborator

can you try this branch: https://github.com/iMicknl/ha-tahoma/tree/enhancement/refactor_climate_%23151

Download and extract the zip https://github.com/iMicknl/ha-tahoma/archive/enhancement/refactor_climate_%23151.zip
Replace the tahoma directory in your custom_components folder by the one in the zip, restart and let me know whether it works.

vlebourl added a commit that referenced this issue Jul 21, 2020
Github Issue: #151 #161
@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

hi, still only able to discover my cover device ... I have also tried to remove the integration , deleted folder Tahoma and copied new folder to custom_components and reinstalled from integration page.

Anyway to check its using this new test-version?

2020-07-21 13:31:23 DEBUG (MainThread) [custom_components.tahoma] Unsupported Tahoma device (internal:PodMiniComponent). Create an issue on Github with the following information.

internal:PodMiniComponent - Pod - Pod
[{"commandName": "getName", "nparams": 0}, {"commandName": "update", "nparams": 0}, {"commandName": "setCountryCode", "nparams": 1}, {"commandName": "activateCalendar", "nparams": 0}, {"commandName": "deactivateCalendar", "nparams": 0}, {"commandName": "refreshPodMode", "nparams": 0}, {"commandName": "refreshUpdateStatus", "nparams": 0}, {"commandName": "setCalendar", "nparams": 1}, {"commandName": "setLightingLedPodMode", "nparams": 1}, {"commandName": "setPodLedOff", "nparams": 0}, {"commandName": "setPodLedOn", "nparams": 0}],
[{"values": ["offline", "online"], "type": "DiscreteState", "qualifiedName": "core:ConnectivityState"}, {"type": "DataState", "qualifiedName": "core:CountryCodeState"}, {"type": "DataState", "qualifiedName": "core:LocalIPv4AddressState"}, {"type": "DataState", "qualifiedName": "core:NameState"}, {"values": ["doublePress", "longPress", "simplePress", "triplePress", "veryLongPress"], "type": "DiscreteState", "qualifiedName": "internal:LastActionConfigButtonState"}, {"type": "ContinuousState", "qualifiedName": "internal:LightingLedPodModeState"}]
2020-07-21 13:31:23 DEBUG (MainThread) [custom_components.tahoma] Unsupported Tahoma device (io:SimpleExteriorHeatingIOComponent). Create an issue on Github with the following information.

io:SimpleExteriorHeatingIOComponent - ExteriorHeatingSystem - DimmerExteriorHeating
[{"commandName": "delayedStopIdentify", "nparams": 1}, {"commandName": "getLevel", "nparams": 0}, {"commandName": "getName", "nparams": 0}, {"commandName": "identify", "nparams": 0}, {"commandName": "off", "nparams": 0}, {"commandName": "on", "nparams": 0}, {"commandName": "setLevel", "nparams": 1}, {"commandName": "setName", "nparams": 1}, {"commandName": "startIdentify", "nparams": 0}, {"commandName": "stopIdentify", "nparams": 0}, {"commandName": "wink", "nparams": 1}, {"commandName": "pairOneWayController", "nparams": 2}, {"commandName": "unpairAllOneWayControllers", "nparams": 0}, {"commandName": "unpairOneWayController", "nparams": 2}],
[{"values": ["good", "low", "normal", "verylow"], "type": "DiscreteState", "qualifiedName": "core:DiscreteRSSILevelState"}, {"type": "ContinuousState", "qualifiedName": "core:LevelState"}, {"type": "DataState", "qualifiedName": "core:NameState"}, {"type": "ContinuousState", "qualifiedName": "core:PriorityLockTimerState"}, {"type": "ContinuousState", "qualifiedName": "core:RSSILevelState"}, {"values": ["available", "unavailable"], "type": "DiscreteState", "qualifiedName": "core:StatusState"}, {"values": ["comfortLevel1", "comfortLevel2", "comfortLevel3", "comfortLevel4", "environmentProtection", "humanProtection", "userLevel1", "userLevel2"], "type": "DiscreteState", "qualifiedName": "io:PriorityLockLevelState"}, {"values": ["LSC", "SAAC", "SFC", "UPS", "externalGateway", "localUser", "myself", "rain", "security", "temperature", "timer", "user", "wind"], "type": "DiscreteState", "qualifiedName": "io:PriorityLockOriginatorState"}]

@vlebourl
Copy link
Collaborator

my bad, I forgot an important part, let me fix that very quickly

@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

great

vlebourl added a commit that referenced this issue Jul 21, 2020
@vlebourl
Copy link
Collaborator

please try again with the last version.

vlebourl added a commit that referenced this issue Jul 21, 2020
@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

okay, some good progress... One new device discovered, but no new entities - and some errors in log file.

DimmerExteriorHeating
af Somfy
Firmware: io:SimpleExteriorHeatingIOComponent

Log snip:

2020-07-21 13:55:29 DEBUG (MainThread) [custom_components.tahoma] Unsupported Tahoma device (internal:PodMiniComponent). Create an issue on Github with the following information. 

 internal:PodMiniComponent - Pod - Pod 
 [{"commandName": "getName", "nparams": 0}, {"commandName": "update", "nparams": 0}, {"commandName": "setCountryCode", "nparams": 1}, {"commandName": "activateCalendar", "nparams": 0}, {"commandName": "deactivateCalendar", "nparams": 0}, {"commandName": "refreshPodMode", "nparams": 0}, {"commandName": "refreshUpdateStatus", "nparams": 0}, {"commandName": "setCalendar", "nparams": 1}, {"commandName": "setLightingLedPodMode", "nparams": 1}, {"commandName": "setPodLedOff", "nparams": 0}, {"commandName": "setPodLedOn", "nparams": 0}], 
 [{"values": ["offline", "online"], "type": "DiscreteState", "qualifiedName": "core:ConnectivityState"}, {"type": "DataState", "qualifiedName": "core:CountryCodeState"}, {"type": "DataState", "qualifiedName": "core:LocalIPv4AddressState"}, {"type": "DataState", "qualifiedName": "core:NameState"}, {"values": ["doublePress", "longPress", "simplePress", "triplePress", "veryLongPress"], "type": "DiscreteState", "qualifiedName": "internal:LastActionConfigButtonState"}, {"type": "ContinuousState", "qualifiedName": "internal:LightingLedPodModeState"}]
2020-07-21 13:55:31 ERROR (MainThread) [homeassistant.components.climate] Error while setting up tahoma platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 378, in _async_add_entity
    capabilities=entity.capability_attributes,
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 189, in capability_attributes
    self.hass, self.min_temp, self.temperature_unit, self.precision
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 26, in display_temp
    temperature = convert_temperature(temperature, temperature_unit, ha_unit)
  File "/usr/src/homeassistant/homeassistant/util/temperature.py", line 29, in convert
    raise ValueError(UNIT_NOT_RECOGNIZED_TEMPLATE.format(from_unit, TEMPERATURE))
ValueError: % is not a recognized temperature unit.

@vlebourl
Copy link
Collaborator

thanks for the report.
this part you can ignore:

2020-07-21 13:55:29 DEBUG (MainThread) [custom_components.tahoma] Unsupported Tahoma device (internal:PodMiniComponent). Create an issue on Github with the following information. 

 internal:PodMiniComponent - Pod - Pod 
 [{"commandName": "getName", "nparams": 0}, {"commandName": "update", "nparams": 0}, {"commandName": "setCountryCode", "nparams": 1}, {"commandName": "activateCalendar", "nparams": 0}, {"commandName": "deactivateCalendar", "nparams": 0}, {"commandName": "refreshPodMode", "nparams": 0}, {"commandName": "refreshUpdateStatus", "nparams": 0}, {"commandName": "setCalendar", "nparams": 1}, {"commandName": "setLightingLedPodMode", "nparams": 1}, {"commandName": "setPodLedOff", "nparams": 0}, {"commandName": "setPodLedOn", "nparams": 0}], 
 [{"values": ["offline", "online"], "type": "DiscreteState", "qualifiedName": "core:ConnectivityState"}, {"type": "DataState", "qualifiedName": "core:CountryCodeState"}, {"type": "DataState", "qualifiedName": "core:LocalIPv4AddressState"}, {"type": "DataState", "qualifiedName": "core:NameState"}, {"values": ["doublePress", "longPress", "simplePress", "triplePress", "veryLongPress"], "type": "DiscreteState", "qualifiedName": "internal:LastActionConfigButtonState"}, {"type": "ContinuousState", "qualifiedName": "internal:LightingLedPodModeState"}]

@vlebourl
Copy link
Collaborator

vlebourl commented Jul 21, 2020

I wanted to have the slider in percents but unfortunately HA doesn't allow that...

vlebourl added a commit that referenced this issue Jul 21, 2020
@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

okay - let me know when its time for another try

@vlebourl
Copy link
Collaborator

you can have another go at it!

@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

some more progress. entity created as well.

However, it seems not to update attributes and state when changing state of device via Somfy App.
Secondly, when testing from dev-tool - both climate.power_on and climate.power_off make go to max level.
and when I try call set temp it complians about expecting an integer , in stead of 30.0 , even when I just type 30

image

hvac_modes:
  - 'off'
  - heat
min_temp: 0
max_temp: 100
current_temperature: null
temperature: 100
uiclass: ExteriorHeatingSystem
widget: DimmerExteriorHeating
type: 'io:SimpleExteriorHeatingIOComponent'
rssi_level: 42
'core:NameState': HEAT. VAR IO
'core:PriorityLockTimerState': 0
'core:StatusState': available
'core:DiscreteRSSILevelState': normal
'core:RSSILevelState': 42
'core:LevelState': 100
friendly_name: HEAT. VAR IO
supported_features: 1

2020-07-21 14:55:52 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281473500619728] Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 544, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 405, in async_set_temperature
    ft.partial(self.set_temperature, **kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tahoma/climate_deh.py", line 57, in set_temperature
    self.apply_action(COMMAND_SET_LEVEL, level)
  File "/config/custom_components/tahoma/tahoma_device.py", line 174, in apply_action
    exec_id = self.controller.apply_actions("HomeAssistant", [action])
  File "/config/custom_components/tahoma/tahoma_api.py", line 395, in apply_actions
    requests.post, BASE_URL + "exec/apply", header, json_data
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 175, in send_request
    + request.text
Exception: Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
2020-07-21 14:56:06 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281473500619728] Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 544, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 405, in async_set_temperature
    ft.partial(self.set_temperature, **kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tahoma/climate_deh.py", line 57, in set_temperature
    self.apply_action(COMMAND_SET_LEVEL, level)
  File "/config/custom_components/tahoma/tahoma_device.py", line 174, in apply_action
    exec_id = self.controller.apply_actions("HomeAssistant", [action])
  File "/config/custom_components/tahoma/tahoma_api.py", line 395, in apply_actions
    requests.post, BASE_URL + "exec/apply", header, json_data
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 175, in send_request
    + request.text
Exception: Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
2020-07-21 14:56:14 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281473500619728] Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 544, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 405, in async_set_temperature
    ft.partial(self.set_temperature, **kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tahoma/climate_deh.py", line 57, in set_temperature
    self.apply_action(COMMAND_SET_LEVEL, level)
  File "/config/custom_components/tahoma/tahoma_device.py", line 174, in apply_action
    exec_id = self.controller.apply_actions("HomeAssistant", [action])
  File "/config/custom_components/tahoma/tahoma_api.py", line 395, in apply_actions
    requests.post, BASE_URL + "exec/apply", header, json_data
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 175, in send_request
    + request.text
Exception: Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
2020-07-21 14:56:16 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281473500619728] Maximum number of consecutive retries reached. Error is:
{"errorCode":"INCOMPATIBLE_VALUE","error":"setLevel() : Invalid value for command parameter p1 : expected integer value between 0 and 100 but got 30.0"}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 544, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 405, in async_set_temperature
    ft.partial(self.set_temperature, **kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tahoma/climate_deh.py", line 57, in set_temperature
    self.apply_action(COMMAND_SET_LEVEL, level)
  File "/config/custom_components/tahoma/tahoma_device.py", line 174, in apply_action
    exec_id = self.controller.apply_actions("HomeAssistant", [action])
  File "/config/custom_components/tahoma/tahoma_api.py", line 395, in apply_actions
    requests.post, BASE_URL + "exec/apply", header, json_data
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 178, in send_request
    self.send_request(method, url, headers, data, timeout, retries - 1)
  File "/config/custom_components/tahoma/tahoma_api.py", line 175, in send_request
    + request.text

vlebourl added a commit that referenced this issue Jul 21, 2020
@vlebourl
Copy link
Collaborator

"However, it seems not to update attributes and state when changing state of device via Somfy App."

HA updates the entity once per minute, so if you interact through the app, you'd need to wait long enough to get it reflected in HA. Have you waited that much? Otherwise I might need to call getLevel somewhere, but for now I'm not sure it's needed.

Second error should be fixed. Can you try again?

@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

okay, you are right state is updated based on temp changes. However, there is an odd behavior , it seems temperate attribute is opposite : 100 means off and 0 means full power. 90 means 10% (comparing to Somfy App and the heater). and both the power-on/off seems to cause the heater to go to max.

One time the state actually changes shortly to "off", but then changed back to "heat" and temp 100 (off)

21T13:35:54.460219+00:00', 'context': {'id': '057d68c08a75450eaac85590bef4ad6f', 'parent_id': None, 'user_id': '423ee73a85414bcc8f6dc2185fe95873'}} old:{'entity_id': 'climate.heat_var_io', 'state': 'heat', 'attributes': {'hvac_modes': ['off', 'heat'], 'min_temp': 0, 'max_temp': 100, 'current_temperature': None, 'temperature': 90, 'uiclass': 'ExteriorHeatingSystem', 'widget': 'DimmerExteriorHeating', 'type': 'io:SimpleExteriorHeatingIOComponent', 'rssi_level': 42.0, 'core:NameState': 'HEAT. VAR IO', 'core:PriorityLockTimerState': 0, 'core:StatusState': 'available', 'core:DiscreteRSSILevelState': 'normal',

These are the only log entries I believe may be from Tahoma plug-in

2020-07-21 15:44:07 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281472905265744] Received invalid command: spotcast/devices 2020-07-21 15:45:48 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281472905265744] Received invalid command: spotcast/devices 2020-07-21 15:45:51 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281472905265744] Received invalid command: spotcast/devices

front-end card when device is off

image

@vlebourl
Copy link
Collaborator

We have a public discord to talk about issues, it will be more reactive than here, can you join there? https://discord.gg/nNzBsK

@vlebourl
Copy link
Collaborator

vlebourl commented Jul 21, 2020

Otherwise, can you change the level in the connexoon app to 0, 25, 50, 75 and 100, and report states in HA after it updates?
I need to figure out the levels before fixing the on / off.

I've added some debug messages to try to understand better what's happening.

vlebourl added a commit that referenced this issue Jul 21, 2020
@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

yes, if I set level to 10 or 15 % in Somfy app, then temperature attribute changes to 90/85 in HA. So assume I need a reverse engine within the integration to translate from Somfy scale to normal scale. similar if I set HA to i.e. 30% it will go to 70% on the Somfy App and the Heather it self. Secondly, temp 100 should be treated as power-off, and power-off action should set temp for 100.

Can't understand the behavior, but will try with your latest release with debug. I have also setup a AppDaemon to track all state and attribute changes.

vlebourl added a commit that referenced this issue Jul 21, 2020
@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

With very old background in C devl, I do understand the basics of Python, and have started to migrate my automation to AppDaemon. That said, I still quite new to HA. But if I can help in any way , please let me know.

@iMicknl
Copy link
Owner

iMicknl commented Jul 21, 2020

@mjhcdk if you could try the latest version, to see if the % is reflected, would be great. :-)

We are working on rewriting the state mechanism to be smarter and faster, but this will take a while.

@mjhcdk
Copy link
Author

mjhcdk commented Jul 21, 2020

hi. latest release does not work, it says entity is unavailable, and no updates to device are possible from HA, and changes from Somfy App, is not reflected in HA. I also tried to remove entity and restart, then its rediscovered but unavailable. No errors in log.

vlebourl added a commit that referenced this issue Jul 22, 2020
Github Issue: #161
@vlebourl
Copy link
Collaborator

Can you try that new branch?
https://github.com/iMicknl/ha-tahoma/tree/fix/fix_161

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

Sure, but how do I "patch" the fix into existing Tahoma folder.

@vlebourl
Copy link
Collaborator

just the same as previously, download the zip here: https://github.com/iMicknl/ha-tahoma/archive/fix/fix_161.zip
and replace your tahoma folder with the one in the zip folder.

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

okay. Getting these errors in log when try to set temp.

2020-07-22 11:31:40 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281472677724880] % is not a recognized temperature unit.
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg), 
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 539, in async_service_temperature_set
    temp, hass.config.units.temperature_unit, entity.temperature_unit
  File "/usr/src/homeassistant/homeassistant/util/temperature.py", line 31, in convert
    raise ValueError(UNIT_NOT_RECOGNIZED_TEMPLATE.format(to_unit, TEMPERATURE))
ValueError: % is not a recognized temperature unit.

image

same error when trying from dev-tool

image

vlebourl added a commit that referenced this issue Jul 22, 2020
@vlebourl
Copy link
Collaborator

vlebourl commented Jul 22, 2020

This one is tougher than I expected...
Can you try the last version?
Naive question, why do you use the service instead of the UI?

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

I tried both, just in case problem was related to frontend. Will try new version

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

seems to be same error. Not an easy one to crack :-)

2020-07-22 12:03:03 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.281473074656400] % is not a recognized temperature unit.
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 539, in async_service_temperature_set
    temp, hass.config.units.temperature_unit, entity.temperature_unit
  File "/usr/src/homeassistant/homeassistant/util/temperature.py", line 31, in convert
    raise ValueError(UNIT_NOT_RECOGNIZED_TEMPLATE.format(to_unit, TEMPERATURE))
ValueError: % is not a recognized temperature unit.
config $      

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

If any help , I could provide you temp access to my tomalink.com account.

@vlebourl
Copy link
Collaborator

I tried both, just in case problem was related to frontend. Will try new version

it's not, I was just curious. The problem is that percent is not a unit for temperature, so when the integration is trying to verify the unit and convert the value if not in the right one (Fahrenheit to Celsius for instance), it crashes on Percent as not recognized.
I'm trying to override every function that does that so that we can trick that device into showing percent, but I'm not sure that it will be possible in the end...

@iMicknl
Copy link
Owner

iMicknl commented Jul 22, 2020

@vlebourl maybe in the end, it is better to just settle for having Celsius in the interface. Otherwise we are making so many modifications to the climate component, which will cause issues in case it gets updated.

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

yeah, its only a minor issue - but of cause nice if it could show what it is really... Maybe some of these fancy custom frontend cards can manipulate the visual appearance.

vlebourl added a commit that referenced this issue Jul 22, 2020
@vlebourl
Copy link
Collaborator

vlebourl commented Jul 22, 2020

And we're back to celsius, sorry I couldn't do more on that...
Can you confirm this version works as expected?

@mjhcdk
Copy link
Author

mjhcdk commented Jul 22, 2020

No problem - Really appreciate all your efforts getting this to work. Latest release is back to Celcius and works. The slider updates are still a bit unpredictable after performing a temp change or power-off. Maybe the delay between set and get is still a bit too short. but never mind, if you are working on a new state-tracker integration It would make sense to wait for the outcome of that. Please let me know if some additional testing is needed.

Thanks again.

@vlebourl
Copy link
Collaborator

All good for now, thanks.

@vlebourl vlebourl mentioned this issue Jul 22, 2020
vlebourl added a commit that referenced this issue Jul 22, 2020
Github Issue: #161
@vlebourl
Copy link
Collaborator

closed by #162

vlebourl added a commit that referenced this issue Jul 23, 2020
* First commit for AtlanticElectricalHeater.
Github Issue: #151

* Refactored climate.
* **Breaking** Removed options flow
* **Breaking** Removed SUPPORT_TARGET_TEMPERATURE for AtlanticElectricalHeater IO component
* Removed private properties.
* Removed update methods.
* Removed __init__ when possible.
* Moved classes to their own files.
* Add DimmerExteriorHeating

Github Issue: #151

* Fix/fix 161 (#162)

Github Issue: #161
iMicknl added a commit that referenced this issue Jul 23, 2020
commit 6caeb9a
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Jul 23 13:21:40 2020 +0200

    Round float state to 2 digits. (#164)

    * Round float state to 2 digits.

    Github Issue: #163

commit e6b4c22
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Jul 23 11:50:11 2020 +0200

    Cover position was incorrectly inverted when 0 because bool(0) == False. (#165)

commit 05cd609
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Jul 23 08:27:39 2020 +0200

    Enhancement/refactor climate (#159)

    * First commit for AtlanticElectricalHeater.
    Github Issue: #151

    * Refactored climate.
    * **Breaking** Removed options flow
    * **Breaking** Removed SUPPORT_TARGET_TEMPERATURE for AtlanticElectricalHeater IO component
    * Removed private properties.
    * Removed update methods.
    * Removed __init__ when possible.
    * Moved classes to their own files.
    * Add DimmerExteriorHeating

    Github Issue: #151

    * Fix/fix 161 (#162)

    Github Issue: #161
iMicknl added a commit that referenced this issue Jul 23, 2020
commit 1de0940
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Thu Jul 23 22:21:56 2020 +0200

    Squashed commit of the following:

    commit 6caeb9a
    Author: Vincent Le Bourlot <vlebourl@gmail.com>
    Date:   Thu Jul 23 13:21:40 2020 +0200

        Round float state to 2 digits. (#164)

        * Round float state to 2 digits.

        Github Issue: #163

    commit e6b4c22
    Author: Vincent Le Bourlot <vlebourl@gmail.com>
    Date:   Thu Jul 23 11:50:11 2020 +0200

        Cover position was incorrectly inverted when 0 because bool(0) == False. (#165)

    commit 05cd609
    Author: Vincent Le Bourlot <vlebourl@gmail.com>
    Date:   Thu Jul 23 08:27:39 2020 +0200

        Enhancement/refactor climate (#159)

        * First commit for AtlanticElectricalHeater.
        Github Issue: #151

        * Refactored climate.
        * **Breaking** Removed options flow
        * **Breaking** Removed SUPPORT_TARGET_TEMPERATURE for AtlanticElectricalHeater IO component
        * Removed private properties.
        * Removed update methods.
        * Removed __init__ when possible.
        * Moved classes to their own files.
        * Add DimmerExteriorHeating

        Github Issue: #151

        * Fix/fix 161 (#162)

        Github Issue: #161

commit 4f1b0a7
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 14:46:13 2020 +0200

    Change debug text

commit f212bc6
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 14:22:44 2020 +0200

    Reference to the right DOMAINS

commit 67e09af
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 14:17:11 2020 +0200

    Reference to official domains

commit a1cf008
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 14:04:37 2020 +0200

    Add missing LOCK import

commit c971da9
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 14:00:06 2020 +0200

    Add constants instead of ugly strings

commit 22a1623
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 13:49:08 2020 +0200

    Change PLATFORMS to SUPPORTED_PLATFORMS

commit a57d246
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 13:08:12 2020 +0200

    Revert removal of DOMAIN

commit bf410ec
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 13:05:30 2020 +0200

    Remove unused imports

commit 4884a5f
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 13:02:27 2020 +0200

    Reformat switch.py

commit 01c1df1
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 12:59:19 2020 +0200

    Bugfix for switch

commit a13348f
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 12:48:39 2020 +0200

    Close client before removing client...

commit 15bb8cd
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 12:45:53 2020 +0200

    Make code more readable

commit d896200
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 12:43:59 2020 +0200

    Close HTTP client correctly

    Thanks @eavanvalkenburg!

commit 24b7190
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 10:18:31 2020 +0200

    Remove unnecessary loop

commit 28cd639
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 09:45:46 2020 +0200

    Refactor based on feedback

commit d3ccafe
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 01:07:08 2020 +0200

    Simply config flow and add better exception logging

commit c38f2e5
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 01:01:39 2020 +0200

    Only initialize platforms with devices and decide platform based on uiclass and widget

commit 4f579b8
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jul 21 00:31:28 2020 +0200

    Add async Python API wrapper
@iMicknl
Copy link
Owner

iMicknl commented Mar 1, 2022

@mjhcdk are you still active here perhaps? I would love to have you test this implementation for core, so that we can bring this to core!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants