Beta for Hysen thermostats powered by broadlink

image

do a restart. Not a hass restart but a system restart.
A folder named pycache should show in the hysen2pfc folder

Sorry for the possibly disappointing reply, but even going as far as unpluggin-replugging my raspberry pi did not solve the problem.
I’ve also commented the tts lines (text to speech section) (in case of)

Did you download the git? Or you copy and paste the raw files?

zip downloading.

this is the log:
Platform not found: climate.hysen2pfc

5:55 PM components/init.py (ERROR)

Unable to find platform hysen2pfc

5:55 PM loader.py (ERROR) - message first occured at 5:52 PM and shows up 3 times

Error loading custom_components.hysen2pfc.climate. Make sure all dependencies are installed

5:55 PM custom_components/hysen2pfc/climate.py (ERROR) - message first occured at 5:52 PM and shows up 3 times

Error doing job: Exception in callback EventBus.async_listen_once.<locals>.onetime_listener(<Event homeassistant_start[L]>) at /srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py:614

5:52 PM components/person/init.py (ERROR)

I’m ready to rebuild the whole hassbian from scratch if needed, i’ve some spare sd card. I can do whatever is needed.

/Toto

try to go to the git and copy paste the raw py files. Sometimes the zip is wrong.

I mean open each file (climate.py, init.py, hysen2pfc_device.py in configurator and paste inside each the corresponding raw file from git

I’ve understood it that way as well.

In final should look like this

( a m a z i n g )

what’s your hass version ?

There is something wrong, because I did paste the raw file and still have the issue. My proposal is to reinstall a fresh hassbian with exactly your version. and try the recommended directory structure.

Be assured that I’ve done what was necessary according to the precription.

0.89.1
But it worked with 0.89.0
I remember now, in 0.88.x the structure was different.
did you upgrade to 89.1?

I’ll only come back once I got a healthy 0.89.1 hass up and running.

cheers !

@uss, Hi thanks for sharing your code looks great and may cause me to suspend my efforts on my version. However I have just tried your code on version 0.89.1 of HA and it wont start up I get the following error

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 238, in async_update_ha_state
    attr = self.state_attributes or {}
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/climate/__init__.py", line 260, in state_attributes
    data[ATTR_OPERATION_MODE] = self.current_operation
  File "/config/custom_components/hysenheating/climate.py", line 591, in current_operation
    return HYSEN_MODE_TO_HASS[self._hysen_device.operation_mode]
KeyError: 1

That is with minimal config as described in your code of

# ***************************************
#  Hysen Termostat Bathroom Floor
#  192.168.07.44
#  75:1a:xx:yy:zz:ww
# ***************************************
  - platform: hysenheating
    name: House Thermostat
    host: 192.168.0.201
    mac: '34:EA:XX:78:XX:B7'
    timeout: 10
    scan_interval: 10

And I know this is a working device as my code is running it fine.

Also to complete the code would you consider adding the following, things I have done and was going to do:

  1. The wifi setup service, something like what I have in my code
  2. dns based lookup of devices
  3. mac discovery of devices, when ip is not fixed
  4. handle ip of device changes once device is setup and running
  5. remove reliance on broadlink.py so the code is self contained

Hi,
The error you have shown looks like in your device the operation_mode manual returns 1 instead of 0 as it returns in my device.
Can you manually put the device in auto mode and restart HA to check if works?
In auto should return 3.
In the mean time I will check your code to see what it returns.

Thanks,
us

I reckon I found the problem.
Is not the manual mode, but the auto mode.
It looks like your device returns 1 in auto mode and not 3 as mine.
In broadlink, reading the operation mode is:

data[‘auto_mode’] = payload[7] & 15

As it is in my code:

self.operation_mode = _response[7] & 0x0F

Thus, in both cases should return the same, except for the case when the devices (yours and mine) do not return the same value, yours 1 and mine 3.
Can you please check what value returns yours in auto mode ?
If returns 1, as I suspect we can try an workaround:

self.operation_mode = _response[7] & 0x01

We might need to change also the set_operation_mode.

Cheers,
us

Hi @uss, so I am trying to use your hysenheating component just to be clear not your hysen2pfc one.

My thermostat returns 0 for manual mode and 1 for auto in the auto_mode variable
data[‘auto_mode’] = payload[7] & 15