Skip to content
Discussion options

You must be logged in to vote

There is a big series of posts that @exetico did to show a variety of ways to do this (#264 (comment)) but this should work:

- name: Fans
  entity: fan.nikheeil_room_fan
  element: fan
  tap_action: toggle
  hold_action: more-info
  state_action:
    service: floorplan.class_set
    service_data: |
      >
        if(hass.states["sensor.wall_switch_nikheeil_2_power"].state >= 40)
          return "spinning";
        else
          return "show"; 

P.S. Next time to make it easier to help you please format your code by highlighting it and pressing the <> button.

Replies: 1 comment 4 replies

Comment options

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

@MadMirza
Comment options

@OzGav
Comment options

@OzGav
Comment options

Answer selected by MadMirza
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants