Coder Social home page Coder Social logo

Comments (2)

ThomDietrich avatar ThomDietrich commented on June 16, 2024 1

Hey,
sounds reasonable to me. Could you please check the Home Assistant "MQTT Discovery" documentation and/or community forum for most conforming way to do this, then propose a PR? Thanks!

from miflora-mqtt-daemon.

the-jeffski avatar the-jeffski commented on June 16, 2024

So, I dug into this and creating the extra element in MQTT is simple enough however as I use the plant component in HA, this also needs to change to understand the new value and to write it to a sensor. All got to be too many dependencies so I have a half way house now of a template to check for any value change in the data coming back and use that. Not 100% perfect but it seems to generally report every update. I'll add an example template here for anyone else who searches for this:

  epipremnum_last_updated:
      friendly_name: "Epipremnum Last Updated"
      unit_of_measurement: timestamp
      icon_template: mdi:clock
      value_template: >
        {% set sensors = [
          states.sensor.epipremnum_battery,
          states.sensor.epipremnum_light,
          states.sensor.epipremnum_moisture,
          states.sensor.epipremnum_conductivity,
          states.sensor.epipremnum_temperature]
          |reject('none')|list %}
        {% set target = sensors | map(attribute='last_updated') | max %}
        {% set target = sensors | selectattr('last_updated', 'eq', target) | list | first %}
        {{ target.last_updated }} 

Closing this off for now.

from miflora-mqtt-daemon.

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.