Light.turn_off does not work, but light.turn_on does

Running the latest version of HA on a pi/ssd. For some reason my automation in HA sends MQTT command light.turn_on just fine. BUT to the exact light (dimmer), it refuses to send light.turn_off.

I am watching the MQTT messaging with an explorer, and this confirms the above is happening.
It also will not send a “toggle” command.

Any ideas would get welcome.

Light. Is not valid, light. Is valid
That’s off the top of my head given the information provided

I got an idea: post your automation and mqtt configuration of your light. Then we can look what is the problem.

Thanks… but I use light.turn_off, and small case everywhere.

Here it is:

  • id: ‘1586486739249’
    alias: Dimmer Off 9:00
    description: ‘’
    trigger:
    • at: ‘21:00’
      platform: time
      condition: []
      action:
    • data: {}
      service: light.turn_off

Use </> and post your mqtt light configuration.

Your automation’s action calls light.turn_off but overlooks to specify which light(s) to turn off.

You need to provide the entity_id: option and indicate which light, or lights, should be turned off.

- id: '1586486739249'
alias: Dimmer Off 9:00
description: ''
trigger:
- at: '21:00'
platform: time
condition: []
action:
- data: {}
service: light.turn_off>

- id: '1586486739249'
  alias: Dimmer Off 9:00
  trigger:
    platform: time
    at: '21:00'
  action:
    service: light.turn_off
    entity_id: light.whatever

The indents didn’t come out right… I apologize. First time posting code.

See Tara’s report. And general forum rule: use </> means you should press that button above the window you this in, so the code is readable and properly formatted.

Here’s what I do:

  1. Type three consecutive back-quotes ``` then press ENTER
  2. Paste your code.
  3. Type three consecutive back-quotes on a new line after your code then press ENTER.

The idea is to “sandwich” your code between two sets of the triple back-quotes. That arrangement tells the editor to format the code.

The way that francisp suggested also works.

  1. Paste your code.
  2. Select all of the code you just pasted.
  3. Click the </> icon in the editor’s toolbar.
- id: '1586486739249'
  alias: Dimmer Off 9:00
  description: ''
  trigger:
  - at: '21:00'
    platform: time
  condition: []
  action:
  - data: {}
    entity_id: light.dimmer_44
    service: light.turn_off

This works perfectly:

- id: dimmer_On1
  alias: dimmer_44 on at 6pm
  trigger:
  - at: '18:00'
    platform: time
  action:
  - data:
      brightness_pct: 100
    entity_id: light.dimmer_44
    service: homeassistant.turn_on

It works with homeassistant.turn_on OR light.turn_on

Some dimmers only turn off when they receive brightness_pct: 0

Yeah, homeassistant.turn_on is more flexible but it generally is preferred to be specific to ensure your context is maintained.
However this is just ‘most people’s’ personal preference, so it’s up to you.

Sorry, about my first response, it was to highlight that what you said (in the post title) was a) wrong, b) misleading and c) requiring more information (which you later provided and which then from, others diagnosed your problem)

That makes sense. When I bang the dimmer bar in the HA Lovelace UI to zero, the light goes off. But the On/Off slide bar in the same interface does nothing.

I will try your suggestion… THANKS!

That usually means there may be something wrong with the configuration of light.dimmer_44. If you like, post its configuration and we will examine it.

This did nothing: (Did not turn off)

- id: '1586486739249'
  alias: Dimmer Off TEST
  description: ''
  trigger:
  - at: '21:00'
    platform: time
  condition: []
  action:
  - data: 
      brightness_pct: 0
    entity_id: light.dimmer_44
    service: light.turn_off