[SOLVED] Issue switch status and automation

I have added to switches to my configuration.yaml which when HA restart it tells me they are off, but they are not. If I turn them on -off -on. On automation any way to disable them from the home screen

I also noticed

Log Details (WARNING)
Sun Jul 22 2018 18:37:44 GMT-0400 (Eastern Daylight Time)

Setup of config is taking over 10 seconds.

add mqtt

mqtt:
broker: core-mosquitto

add mqtt switches

switch:

  • platform: mqtt
    name: “Turtle Tank Lights”
    command_topic: “cmnd/sonoff61/power”
    state_topic: “stat/sonoff61/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

  • platform: mqtt
    name: “Turtle Tank Outlet”
    command_topic: “cmnd/sonoff52/power”
    state_topic: “stat/sonoff52/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

automations.yaml

  • alias: “Turtle Tank Lights On”
    trigger:
    platform: time
    at: ‘07:15:00’
    action:

    • service: homeassistant.turn_on
      entity_id: switch.turtle_tank_lights
  • alias: “Turtle Tank Lights Off”
    trigger:
    platform: time
    at: ‘23:10:00’
    action:

    • service: homeassistant.turn_off
      entity_id: switch.turtle_tank_lights

thanks for any assistant

Yes I’m an old dog trying to learn new tricks, and face planting too many times today.

Are you only using the HA frontend to turn off and on the lights? Or is there a physical switch involved?

MQTT can be a bit quirky.

we are trying to get the turtle light on a schedule. the outlet we have been push the button but waiting the for momentary switch to come in so i could setup gpio14 on HA 0.74.0 and tasmota 6.1.1c

See if you can sub to the sonoff topics and see if it is publishing a message when you press the button. The real issue here is that when a physical switch is pressed it needs to tell the MQTT broker that the light has been turned on via MQTT with the ‘retain’ flag. I don’t particularly like Tasmota and only have it on 1 switch so I can’t remember if it publishes a retained message on physical switch.

temp fix on the connect to sonoff (or device which has been tasmotaized) go to console and in the command line type PowerRetain 1

I don’t know the effects but in the short term resolves the issue.

not to show automation on overview page:

add hide_entity: True

example

  • alias: “Lights On”
    hide_entity: True