Add switch platform for calling a service - light-switch/button with specific brightness

I have a dimmer that controls a fan and I want to create a switch that sets one brightnessvalue for ON and another brightness value for OFF

In this case I want ON to be brightness: 230 and OFF to be brightness: 30

how can I create this switch? I have tested the JSON script and it works I just dont know how to make it a simple switch :frowning:

{
“entity_id”: “light.fan”,“brightness”:230
}

I’m using tellstick light component to send the signal

Okay either is my question is weird or the answer is really tough? Or too easy to answer? I’ve searched everywhere and the closest find is this topic which seems to be exactly what I want

none of the answers there seem to be quite easy to do though

I’m new to HA and really would appreciate some help :frowning:

Here’s a way of doing it, with template switch

switch:
  
  - platform: template
    switches:
      
      fan_light:
        value_template: "{{ is_state('light.fan', 'on') }}"
        turn_on:
          - service: light.turn_on
            data:
              entity_id: light.fan
              brightness: 230
        turn_off:
          - service: light.turn_on
            data:
              entity_id: light.fan
              brightness: 30

You could also do it with an Input Boolean switch. Let me know if you're interested in doing it that way.
1 Like

Thanks! I’ll try it out. I managed to solve it with script but this will be much better

1 Like

Sorry I have a question about this

value_template: “{{ is_state(‘light.fan’, ‘on’) }}”

I have a similar problem about this, I have no sensor to observe the state of the switch. So, how can I create a switch ? Is light.fan a sensor? I can call a service with JSON to activate the device

If I can’t add a template sensor without a sensor, please how to do it with a input Boolean switch…

No, it’s not a sensor. In that example it’s a light.

Did you try the code I poster previously with one of your lights?

1 Like

Problem already solved, Thanks!

1 Like