Closed Emacee closed 6 years ago
Yeah I'm following that thread and want to add support for it as well, but it's yet unclear to me how to install the toon app, I rather install the separate tool, not an app store.... is that possible?
Since I wasn't sure enough to root the Toon myself I bought one that was rooted already and came with the ToonStore installed. Must say, the ToonStore is really convenient.
For future reference, this is the first version of code that was posted:
- platform: rest
name: Boiler Status
json_attributes:
- sampleTime
- boilerSetpoint
- roomTempSetpoint
- boilerPressure
- roomTemp
- boilerOutTemp
- boilerInTemp
- boilerModulationLevel
resource: http://toon/boilerstatus/boilervalues.txt
value_template: '{{ value_json.sampleTime }}'
The issue with that is that the sensor is sampleTime with all the values as attribute rather than different sensors with as attribute the sample time. I will look into the Home-Assistant docs to see whether that is an easy fix. Don't have any development experience so far so can't promise anything.
P.S. Created this Home-Assistant meets Toon load screen for the Toon to display something nice on startup.
Whoa that was easy, this way it works as sensor. Would this be possible to incorporate it into a component so you would only have to set TOON-IP choose which sensors you would want? Or is that not the way it works?
- platform: rest
name: Boiler Status
json_attributes:
- sampleTime
- boilerSetpoint
- roomTempSetpoint
- boilerPressure
- roomTemp
- boilerOutTemp
- boilerInTemp
- boilerModulationLevel
resource: http://TOON-IP/boilerstatus/boilervalues.txt
value_template: '{{ value_json.sampleTime }}'
- platform: rest
name: Boiler Pressure
json_attributes:
- sampleTime
- boilerSetpoint
- boilerModulationLeve
resource: http://TOON-IP/boilerstatus/boilervalues.txt
value_template: '{{ value_json.boilerPressure }}'
unit_of_measurement: bar
- platform: rest
name: Boiler setpoint
json_attributes:
- sampleTime
- boilerSetpoint
- boilerPressure
- boilerModulationLevel
- roomTemp
- roomTempSetpoint
resource: http://TOON-IP/boilerstatus/boilervalues.txt
value_template: '{{ value_json.boilerSetpoint }}'
unit_of_measurement: "°C"
- platform: rest
name: Boiler In Temperature
json_attributes:
- sampleTime
- boilerOutTemp
- boilerInTemp
- boilerSetpoint
resource: http://TOON-IP/boilerstatus/boilervalues.txt
value_template: '{{ value_json.boilerInTemp }}'
unit_of_measurement: "°C"
- platform: rest
name: Boiler Out temperature
json_attributes:
- sampleTime
- boilerOutTemp
- boilerInTemp
- boilerSetpoint
resource: http://TOON-IP/boilerstatus/boilervalues.txt
value_template: '{{ value_json.boilerOutTemp }}'
unit_of_measurement: "°C"
- platform: rest
name: Boiler modulation level
json_attributes:
- sampleTime
- boilerSetpoint
resource: http://TOON-IP/boilerstatus/boilervalues.txt
value_template: '{{ value_json.boilerModulationLevel }}'
unit_of_measurement: "%"
Result looks like this:
I wrote a custom component, can you try it out? https://github.com/cyberjunky/home-assistant-custom-components#toon-boiler-status-sensor-component
Works great! Thanks so much for helping out so far already! Maybe nice to add the sample time as attribute to each sensor (so it doesn't have to a separate sensor if you wish). That way you can see by clicking on the sensor the exact time of last measurement.
Do you think it would be helpful if we would try to integrate this component into the Home-Assistant repository? Rather than a custom component.
Yes will have a look at the attribute idea, thanks. About the official repo, I tried this before with the climate component, but ran into all sort of restrictions. It took me too much time, but now that the non rooted toon component is added, I can use that as an example, saves alot of discussions about internal naming of variables etc.
Ah I see. I think it would greatly contribute to the awareness of this component and hopefully adds more users which makes it more fun to contribute to the project I guess. If I can be of any help, just let me know.
I have changed sampletime to be used as attribute of the sensors, so with the updated code you need to remove it as resource from the config.
With your updated code I now get this error:
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 399, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 247, in async_add_entity
yield from entity.async_update_ha_state()
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 218, in async_update_ha_state
device_attr = self.device_state_attributes
File "/config/custom_components/sensor/toon_boilerstatus.py", line 140, in device_state_attributes
if self._last_updated is not None:
AttributeError: 'ToonBoilerStatusSensor' object has no attribute '_last_updated'
By removing this part of the code of the toon_boilerstatus.py I was able to get it working again however the attribute of sample time doesn't work then (not very surprising haha).
+ @property
+ def device_state_attributes(self):
+ """Return the state attributes of this device."""
+ attr = {}
+ if self._last_updated is not None:
+ attr['Last Updated'] = self._last_updated
+ return attr
+
I forgot to init the variable, I have updated the component. No idea why it worked here.
Works like a charm now! Thanks so much.
As discussed from this post on: Toon app: boiler status the Toon is able to display the status of an OpenTherm boiler. If it would be possible to incorporate this data in Home-Assistant the need for an OpenTherm Gateway is taken away since you will be able to log and monitor the behaviour of your boiler more closely.