Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 103304

Help using attributes in "above" and "below" scripting

$
0
0

Hello!
I am trying to control my battery depending on weather.
The end result is to not discharge battery if electricity is below daily average since its cheaper to buy from the grid.

Which means if sensor.electricity_price_stenbrottsgatan attribute “price_level” is above or below attribute “avg_price”.

I havent done much outside of the GUI scripting before since I havent needed to, but now I am trying to do something that HA GUI does not support diffing 2 attributes against each other.

Any idea how to make this flow work?
The part which does not work is ofc "Above/Below: “{{ parts }}”.

alias: Solceller - Discharge control
description: ''
mode: single
trigger:
  - type: value
    platform: device
    device_id: 7c55e92786ad7a593c2aa71bcd74261a
    entity_id: sensor.electricity_price_stenbrottsgatan
    domain: sensor
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: numeric_state
                entity_id: sensor.solceller_xioqdrhwj2_realtime_power
                below: '2'
              - condition: numeric_state
                entity_id: sensor.electricity_price_stenbrottsgatan
                attribute: price_level
                above: "{{(state_attr('sensor.electricity_price_stenbrottsgatan', 'avg_price'))}}"
        sequence:
          - device_id: ff076423060843a775e130cecff60ab6
            domain: number
            entity_id: number.maximum_discharging_power
            type: set_value
            value: 5000
      - conditions:
          - condition: and
            conditions:
              - condition: numeric_state
                entity_id: sensor.solceller_xioqdrhwj2_realtime_power
                below: '2'
              - condition: numeric_state
                entity_id: sensor.electricity_price_stenbrottsgatan
                attribute: price_level
                below: "{{(state_attr('sensor.electricity_price_stenbrottsgatan', 'avg_price'))}}"
        sequence:
          - device_id: ff076423060843a775e130cecff60ab6
            domain: number
            entity_id: number.maximum_discharging_power
            type: set_value
            value: 0
    default:
      - device_id: ff076423060843a775e130cecff60ab6
        domain: number
        entity_id: number.maximum_discharging_power
        type: set_value
        value: 5000

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 103304

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>