Comments (11)
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.
from home-assistant-custom-components.
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?
from home-assistant-custom-components.
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.
from home-assistant-custom-components.
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:
from home-assistant-custom-components.
I wrote a custom component, can you try it out?
https://github.com/cyberjunky/home-assistant-custom-components#toon-boiler-status-sensor-component
from home-assistant-custom-components.
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.
from home-assistant-custom-components.
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.
from home-assistant-custom-components.
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.
from home-assistant-custom-components.
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
+
from home-assistant-custom-components.
I forgot to init the variable, I have updated the component. No idea why it worked here.
from home-assistant-custom-components.
Works like a charm now! Thanks so much.
from home-assistant-custom-components.
Related Issues (20)
- Toon climate and smartmeter not working since 0.89 HOT 8
- Error while setting up platform Toon in 0.90.1 HOT 1
- SolarPortal no longer working HOT 5
- Branderinfo Toon HOT 4
- Toon with 0.92 HOT 4
- Plugwise 0.92.1 HOT 2
- Support for custom_updater HOT 6
- Plugwise timeouts HOT 5
- Feature request: Total power usage current day HOT 4
- [Smartmeter] Sensors remain "unknown" HOT 1
- toon_climate not working after Home Assistant update 0.96 HOT 20
- Can't import repo in Home Assistant HOT 1
- plugwise outlets not working with home assistant 0.96 HOT 2
- After install it won't connect HOT 4
- P2000 component location wrong HOT 2
- Plugwise not working anymore HOT 3
- Home Assistant Community Store support? HOT 7
- ModuleNotFoundError: No module named 'homeassistant.components.plugwise.switch' HOT 2
- Solarportal: no updates and error logs AttributeError: 'NoneType' object has no attribute 'find'
- The plugwise platform for the switch integration does not support platform setup. Please remove it from your config.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home-assistant-custom-components.