Giter Site home page Giter Site logo

Comments (12)

bramstroker avatar bramstroker commented on September 15, 2024

I did some development last week to use state attributes for configuration of power usage. See #60

That allows you to do something like this:

- platform: powercalc
  entity_id: media_player.playstation_4
  fixed:
      states_power:
        media_content_type|gaming: 6
        standby: 1.25
        idle: 1.8

But I think we can also allow template sensors as the entity as you request. This is a small change, will do it this week.

from homeassistant-powercalc.

wranglatang avatar wranglatang commented on September 15, 2024

That sounds great! Using a Sensor. Works best for me as it is much more flexible. I have a few media players that will use different amounts of Power depending on the volume setting, so using a template sensor allows this complex logic to be created by the users.

from homeassistant-powercalc.

wranglatang avatar wranglatang commented on September 15, 2024

Just seen you have a pull request open to add in the sensor domain & also a couple other items suggested by others! Looking forward to your next release! :)

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on September 15, 2024

Yes. Going to finish (and test) this soon. But quite busy the next days. So will be end of the weekend or beginning of next week.

from homeassistant-powercalc.

wranglatang avatar wranglatang commented on September 15, 2024

Let me know if you want me to do any testing for you :)

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on September 15, 2024

This has been merged into master. Are you able to test with the master branch?

from homeassistant-powercalc.

wranglatang avatar wranglatang commented on September 15, 2024

Absolutely! Can update from HACS? or will i need to manually copy?

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on September 15, 2024

You can from Hacs. Just go to the integration overview click on the 3 dots in the powercalc integration and than "reinstall"

from homeassistant-powercalc.

wranglatang avatar wranglatang commented on September 15, 2024

Okay, its installed, But it doent seem to work:
image

Here is my configuration for my sensor template:

    playstation_4_state:
      value_template: >-
        {% if state_attr('media_player.playstation_4', 'media_content_type') == 'game' %}
          gaming
        {% elif states('media_player.playstation_4') == 'standby' %}
          rest
        {% elif states('media_player.playstation_4') == 'idle' %}
          menu
        {% else %}
          off
        {% endif %}

Here is the configuration of powercalc:

- platform: powercalc
  name: playstation_4_power
  entity_id: sensor.playstation_4_state
  fixed:
    states_power:
      rest: 11
      menu: 57
      gaming: 93
  standby_usage: 0.7

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on September 15, 2024

Any errors in the logs? Could you also enable debug logs for the component. See the readme how to do that.
I don't have time the next two days, but will have a look when I'm back

from homeassistant-powercalc.

wranglatang avatar wranglatang commented on September 15, 2024

Ah! it seems that deleting the entity using that "Remove Entity" button then restarting HA has fixed it! Seems like changing the Entity that the PowerCalc was using caused it to break. Would it have cached its config.

I turned on debugging and no errors in the logs.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on September 15, 2024

Ok nice. So everything is working now? No Idea why you had to remove the entity first

from homeassistant-powercalc.

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.