Skip to content

sensor for grid show only positive value, flow depend on direction (forward or reverse) #636

Answered by goanes
goanes asked this question in Q&A
Discussion options

You must be logged in to vote

I have created a new file sensor.yaml

- platform: template
  sensors:
    power_a_with_negative_value:
      friendly_name: power_a_with_negative_val
      value_template: >-
        {%if states.sensor.direction_a.state == "REVERSE"%}
          {{"-"+states.sensor.power_a.state}}
        {%else%}
          {{states.sensor.power_a.state}}
        {%endif%}

    power_b_with_negative_value:
      friendly_name: power_b_with_negative_val
      value_template: >-
        {%if states.sensor.direction_b.state == "REVERSE"%}
          {{"-"+states.sensor.power_b.state}}
        {%else%}
          {{states.sensor.power_b.state}}
        {%endif%}

    power_a_2_with_negative_value:
      friendly…

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@nettunoroberto
Comment options

@goanes
Comment options

@goanes
Comment options

Answer selected by goanes
@goanes
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants