Git Product home page Git Product logo

Comments (3)

MattJeanes avatar MattJeanes commented on August 17, 2024

Interesting! You should be able to work around this by using an automation to update an input_number integration when the Octopus integration entity changes rather than using the value of it directly. This should avoid the entity becoming unavailable if it depends on cloud sources such as the Octopus one and also allows it to be updated by other sources too if you have e.g. incoming solar energy.

In my case, I use Octopus Intelligent and I have a similar automation because that integration doesn't tell me the price, only if it's currently on the "low" or "high" prices, so I use that to update my input_number appropriately.

I don't think it would necessarily always be a good idea to ignore "unavailable" states as this could result in silent inaccurate measurements, which as you say may not be the correct fix for every use case, so for you and anyone else with similar issues, I would recommend doing this.

from teslamateagile.

AlbertoZen avatar AlbertoZen commented on August 17, 2024

Thanks @MattJeanes what you suggested is actually a very good idea, I created a simple automation

alias: Copy Octopus Tracker Electricity Rate to Teslamate
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.octopus_energy_electricity_xxxxxxxxxxx_xxxxxxxxxxxxx_current_rate
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: >-
          sensor.octopus_energy_electricity_xxxxxxxxxxx_xxxxxxxxxxxxx_current_rate
        state: unavailable
      - condition: state
        entity_id: >-
          sensor.octopus_energy_electricity_xxxxxxxxxxx_xxxxxxxxxxxxx_current_rate
        state: unknown
action:
  - service: input_number.set_value
    metadata: {}
    data:
      value: >-
        {{
        states('sensor.octopus_energy_electricity_xxxxxxxxxxx_xxxxxxxxxxxxx_current_rate')
        | float }}
    target:
      entity_id: input_number.teslamateoctopustracker
mode: single

This should copy the electricity rate from the Octopus add-on to a numeric input "input_number.teslamateoctopustracker" when the status is not "unknown" or "unavailable", I'm sure it can be massively improved (I'm not great with templating) but it seems to do the job.

from teslamateagile.

MattJeanes avatar MattJeanes commented on August 17, 2024

That looks perfect to me, nice!

Hopefully that does the job for you, so I'll go ahead and close this :)

from teslamateagile.

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.