peternijssen / spiderpy

Unofficial Python wrapper for the Spider API from Itho Daalderop, to control your Spider installation.
MIT License
4 stars 3 forks source link

Fan control #3

Closed wjketting closed 5 years ago

wjketting commented 5 years ago

When will the fan option be available? I'm running Home Assistant as Hassio install. Is it possible to do a custom install to test in meanwhile?

peternijssen commented 5 years ago

Thanks for your report. I will try to integrate it within HA. Problem is only that I don't have a fan myself that works with Spider, so I cannot guarantee from the start that it will work perfectly.

Will work on it this weekend and see what I can do.

wjketting commented 5 years ago

ok, well let me know if i can help. I have the spider system with fan installed with humidity and co2 sensors. Also smart meter plugins (gas and electricity).

peternijssen commented 5 years ago

Could you try the following:

Place the following code in "custom_components/spider.py": https://gist.github.com/peternijssen/32079cddec03c90149509a51169a7e3d

Place the following code in "custom_components/climate/spider.py": https://gist.github.com/peternijssen/6adbc57375b2c2fb5bd1470809b149d5

You can enable additional debugging in HA:

logger:
  default: error
  logs:
    custom_components.spider: debug
    custom_components.climate.spider: debug

You should now be able to control the fan speed. Let me know if it worked or not, so I can make it formal part of HA.

Thanks!

wjketting commented 5 years ago

Installed the packages as adviced. Next error messages showed up during restart of HA

2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed' 2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed' 2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed' 2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed' 2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed' 2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed' 2019-02-04 20:16:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state attr = self.state_attributes or {} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 265, in state_attributes data[ATTR_FAN_MODE] = self.current_fan_mode File "/config/custom_components/climate/spider.py", line 143, in current_fan_mode return self.thermostat.current_fan_speed AttributeError: 'SpiderThermostat' object has no attribute 'current_fan_speed'

peternijssen commented 5 years ago

Sure you also did the first file? (/custom_components/spider.py) I know both files are called spider.py, they are different and in a different folder.

wjketting commented 5 years ago

Yes, I’ll try again (and double check) this evening when I get home.

wjketting commented 5 years ago

Odd, after the test yesterdat I renamed the files to .pybak and restarted HA. Today I checked if the files where in the right location and then renamed them back to .py. Checked the configuration and restarted HA. Now the component loads without the error message. Tested the status reporting using the spider control. Worked fine. Will test setting the speeds with HA tomorrow. afbeelding

peternijssen commented 5 years ago

Strange. Anyways, great it's working now. Looking forward hearing from you if it all works.

I am not sure if the list of options matches your fan. No clue if they are the same for all fans. You could check mijn.ithodaalderop.nl I guess for your actual options.

peternijssen commented 5 years ago

@wjketting any news? Then I integrate it in HA by default.

wjketting commented 5 years ago

Had some time this morning after long week with long hours work. Testing went well, all modes respond as expected. Ready to release...!

wjketting commented 5 years ago

Peter,

Noticed a little odd thing today.

I have 7 thermostatic valves in my house. 4 of them are controlled by wall mounted thermostat displays (1 in living room and 1 in bathroom with fan control, 2 in bedrooms without fan control).

All 7 climate controls in HA show the fan status/input selection (livingroom climate reports correct fan_mode, all others - including bathroom climate report "idle").

In HA the fan can be controlled with living room climate control, but not with bathroom climate control and obviously also not with the other 5 climate controls (since they are not connected to the fan).

I would expect the bathroom climate also reports the correct fan_mode and could be used to change the fan_mode.

Is this the way it was intended of something that needs a bit to work on?

Not a big issue since HA can read and set the fan using the livingroom climate attributes.

https://github.com/home-assistant/home-assistant/pull/20897 thanks for the added support!

peternijssen commented 5 years ago

There is a small "bug" in the code you used: https://gist.github.com/peternijssen/6adbc57375b2c2fb5bd1470809b149d5#file-spider-py-L70 It doesn't check if the thermostat provides fan support.

In the final implementation in HA, it is resolved: https://github.com/home-assistant/home-assistant/pull/20897/files#diff-bfa9506a2c24c55278c31c5945a4cd52R71 So your 2 bedrooms should no longer see the fan support when HA is released.

I would expect indeed that your living room and bath room are displaying the same state. However, I am depending on the ithodaalderop website. What you could do is go to https://mijn.ithodaalderop.nl and change the fan mode over there for either the living room or bath room and see if both are changed. If they somehow display the same state, I will mimic that behaviour if this library does not.

I suspect the fan support is coming in 0.88, which is expected around 20 feb. For now you can use the custom_component as you did now and then remove them when you update to 0.88.

wjketting commented 5 years ago

Thanks for the extra info.

I made the changes to the file I have copied in custom components/climate and after restarting HA all but the livingroom climate has the fan mode state and settings. The bathroom climate lost his fan_mode as well.

When checking the daalderop website I noticed the bathroom thermostat does not show the fan either. It is however installed, connected, working and reflecting actual fan mode on both bathroom as well as living room displays. Must be a limitation on Itho's side.

p.s. Boost 10, 20 etc are actual fan modes. Setting it increases fan speed to high for 10, 20 or 30 minutes. After the time expires it returns to previous mode. Boost modes are displayed on the themostat displays as well.

Cheers.

peternijssen commented 5 years ago

Alright. Thanks!

And yeah, it is limited on their website. I hope that one day, they open up their protocol or someone is able to tap in to it. Then we are no longer depending on the web interface, because if ever the web interface changes, this whole system might break.

Anyways, enjoy your fan and if anything arises, just report it in HA and I'll take it from there.

Thanks for your help!