Problem with switching lights

I’m new to home automation and i hope iv put this into the right place

Iv been working on automating my house lighting with a raspberry pi running hassio with mosquitto node red and Alexa, working on 2 Arduino megas, one for the switch board and one for 20 relays. I also have 2 sonoff running just for testing which are working fine with hassio, node red and Alexa.

I am having a problem with hassio switching, for the Arduino’s

Hass will switch on the lights but will not switch the lights off.

Alexa turns on the lights but will not turn them off.

Node red turns lights on and off as it should.

The switch board turns the lights on and off ok.

Everything shows up in hassio overview as on and off ok.

As far as I can see the topics are all ok because in the mqtt, the momentary switches are working fine.

Any help would be much appreciated.

How do you have the switches defined in home assistant?

Hi petro
Thanks for getting back to me.
This is a snape shot part of my yaml file
Switches 1 and 2 are my Sonoff’s

mqtt:
broker: 192.168.1.101
client_id: home-assistant-pi
username: XXXXXXX
password: XXXXXXXX

Cloud

cloud:
alexa:
filter:
include_entities:
- switch.bathroom_fan
- switch.Bathroom_shelf
- switch.livingroom_front_light
- switch.livingroom_back_light
- switch.kitchen_main_light
- switch.kitchen_counter_lights
- switch.back_garden_lights
- switch.stairs_main_lights
- switch.front_garden_lights
- switch.under_stairs_light
- switch.stairs_cupboad_up_light
- switch.Bathroom_main_light
- switch.Bathroom_leds
- switch.Backbedroom_main_light
- switch.Frontbedroom_main_light
- switch.Frontbedroom_cupboard_light
- switch.Loft_light
- switch.Masterbedroom_main_light
- switch.Masterbedroom_right_light
- switch.Masterbedroom_right_light

switch 1:

  • platform: mqtt
    name: “Bathroom fan”
    command_topic: “cmnd/Bathroom_fan/power”
    state_topic: “stat/Bathroom_fan/POWER”
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    retain: true
    switch 2:
  • platform: mqtt
    name: “Bathroom shelf”
    command_topic: “cmnd/Bathroom_light_shelf/power”
    state_topic: “stat/Bathroom_light_shelf/POWER”
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    retain: true
    switch 3:
  • platform: mqtt
    name: “Livingroom front light”
    command_topic: “lights/livingroom/front”
    state_topic: “lights/livingroom/front”
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    retain: true
    switch 4:
  • platform: mqtt
    name: "Livingroom back light "
    command_topic: “lights/livingroom/back”
    state_topic: “lights/livingroom/back”
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

Is home assistant seeing the ‘off’ service from alexa?

yes home assistant is seeing Alexa turn the lights on and off, so does node red and Arduino serial monitor

So, what do the logs say for home assistant after alexa turns off the lights? Basically you need to play ‘spot the difference’ when it turns off vrs not and then fix that.

can you tell me where the logs are

Yeah, in your config folder there is a home-assistant.log text file. Use notepadd++ to watch it, it should update regularly.