Giter Club home page Giter Club logo

Comments (11)

cyberjunky avatar cyberjunky commented on June 5, 2024 1

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.

cyberjunky avatar cyberjunky commented on June 5, 2024

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.

Emacee avatar Emacee commented on June 5, 2024

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.
loadscreen-toon

from home-assistant-custom-components.

Emacee avatar Emacee commented on June 5, 2024

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:

schermafbeelding 2018-01-27 om 11 49 14

from home-assistant-custom-components.

cyberjunky avatar cyberjunky commented on June 5, 2024

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.

Emacee avatar Emacee commented on June 5, 2024

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.

boiler status

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.

cyberjunky avatar cyberjunky commented on June 5, 2024

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.

Emacee avatar Emacee commented on June 5, 2024

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.

Emacee avatar Emacee commented on June 5, 2024

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.

cyberjunky avatar cyberjunky commented on June 5, 2024

I forgot to init the variable, I have updated the component. No idea why it worked here.

from home-assistant-custom-components.

Emacee avatar Emacee commented on June 5, 2024

Works like a charm now! Thanks so much.
schermafbeelding 2018-01-28 om 15 27 34

from home-assistant-custom-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.