Really simple query on switch auto-off (SOLVED)

Hi

I use Alexa with HA to change my TV channels. (“Alexa, turn on one”) I use a Broadcom RM with an MQTT/python interface (easier to maintain than using the HA alternative imho).

However, HA always thinks that I have a switch on when I change channel. Is there an easy way to tell the switch to turn itself off as soon as it has switched on?

Current code:

- platform: mqtt
  name: "Channel BBC1"
  command_topic: "broadlink/bbc1"
  payload_on: "macro"
  optimistic: true
  retain: false

what if you set the value_template for the switch to false.

value_template (Optional): Defines a template to extract a value from the payload.

value_template: “false”

Nope, didn’t work.

And neither did

  value_template: false

I was actually toying with this on another issues.

try using the value_template
and added a null state topic

state_topic: "null/null"
value_template: "false"

or

state_topic: "null/null"
value_template: false

I believe you need the state_topic set in order to use value_template

2 Likes

Yup, that’s the one. Thanks.