Picture elements state image

Hello, i’m a noob and try to create a picture elements card for my heatpipe system.
What i want is that if a relay (sensor.pump_speed_relay_x) is 0% it shows an pump image that represents the not working state if the state of the relay > 0% it shows the working state.

This is my card so far and i tried it with switch witch obviously wont work.
anyone can help me started?
Thanks in advance for your time.

type: picture-elements
image: /local/resolmx/system/heatpipe_system_2_1_2.png
elements:

  • type: state-badge
    entity: sensor.temperature_sensor_12
    style:
    top: 9%
    left: 9%
    font-size: 11px
  • type: state-badge
    entity: sensor.temperature_sensor_1
    style:
    top: 10%
    left: 30%
    font-size: 11px
  • type: state-badge
    entity: sensor.temperature_sensor_6
    style:
    top: 10%
    left: 76%
    font-size: 11px
  • type: state-badge
    entity: sensor.temperature_sensor_2
    style:
    top: 75%
    left: 81.4%
    font-size: 11px
  • type: state-badge
    entity: sensor.output_a
    style:
    top: 77.8%
    left: 33%
    font-size: 11px
  • type: image
    entity: sensor.pump_speed_relay_2
    tap_action:
    action: none
    image: /local/resolmx/valve/v_vertical_off.png
    state_image:
    ‘on’: /local/resolmx/valve/v_vertical_on.png
    ‘off’: /local/resolmx/valve/v_vertical_off.png
    style:
    top: 55%
    left: 18.6%
    width: 4.4%
  • type: image
    entity: sensor.pump_speed_relay_3
    tap_action:
    action: none
    image: /local/resolmx/valve/v_vertical_off.png
    state_image:
    ‘on’: /local/resolmx/valve/v_vertical_on.png
    ‘off’: /local/resolmx/valve/v_vertical_off.png
    style:
    top: 55%
    left: 40%
    width: 4.4%
  • type: image
    entity: sensor.output_a
    tap_action:
    action: none
    image: /local/resolmx/pump/pump_up_off.png
    state_image:
    ‘on’: /local/resolmx/pump/pump_up_on.png
    ‘off’: /local/resolmx/pump/pump_up_off.png
    style:
    top: 75%
    left: 18.6%
    width: 9.4%

picture-elements

took me a while but solved it by creating a binary sensor.

binary_sensor:

  • platform: template
    sensors:

    heatpipe valve south

    pump_speed_relay_2:
    friendly_name: “relay_2_onoff”
    value_template: >-
    {{ states(‘sensor.pump_speed_relay_2’)|float > 0 }}
    ## heatpipe valve west
    pump_speed_relay_3:
    friendly_name: “relay_3_onoff”
    value_template: >-
    {{ states(‘sensor.pump_speed_relay_3’)|float > 0 }}
    pump_speed_relay_4:
    friendly_name: “relay_4_onoff”
    value_template: >-
    {{ states(‘sensor.pump_speed_relay_4’)|float > 0 }}
    output_a:
    friendly_name: “relay_5_onoff”
    value_template: >-
    {{ states(‘sensor.output_a’)|float > 0 }}