Get Tasmota Switch Status

Have a SONOFF in the wall with a Switch attach GPIO14

I want to know what the status of the Switch

I see this in the console

and the Switch is off

turn it ON I see

in the console I type
TelePeriod 10 that send a MQTT every 10 sec

Bugger the Switch is the Wrong way round

could just turn the switch round in the wall or change it in Tasmota

SwitchMode1 2

1 = which switch am i changing
2 = Set switch mode to inverted FOLLOW (0 = On, 1 = Off)

now the HA stuff

    
    # TelePeriod 10
  - platform: mqtt  
    name: Office Switch 
    state_topic: "tele/office/SENSOR"
    value_template: "{{value_json['Switch1']}}"

add it to a group

and I see

image

and

image

now arm with this I can create a Automation

something like
as I have Climate on the Cupboard Heater

if the Heater Switch is OFF I want the Climate to be off
when I turn the Switch ON I want the Climate ON and controling the heat

SO the ON bit

- id: Automation Heater ON
  alias: Automation Heater ON
  trigger:
  - entity_id: sensor.heater_switch
    from: 'OFF'
    platform: state
    to: 'ON'
  condition: []
  action:
  - data:
      entity_id: climate.cupboard_heater
      operation_mode: heat
    service: climate.set_operation_mode

the OFF bit

- id: Automation Heater OFF
  alias: Automation Heater OFF
  trigger:
  - entity_id: sensor.heater_switch
    from: 'ON'
    platform: state
    to: 'OFF'
  condition: []
  action:
  - data:
      entity_id: climate.cupboard_heater
      operation_mode: 'off'
    service: climate.set_operation_mode

with the Switch ON I get this

image

only did this so the wife think she is in control of the Cupboard Heater LOL

hope this make cents
and help someone

I don’t think you’ll make any cents (or dollars) with this as your post doesn’t make sense.

I’m only trying to help I put my idea’s into text’s I have a little problem I have dyslexia so what I type is what’s in my head so sorry about the bad English

As I find it hard to read these post I just wing it think of idea and make it happen sometime so a lot of pulling hear

All I can say my house does thing base on what who and thing happing in my house I dont put the phone out of my pocket and turn something on my house us does it

1 Like

I’m having an issue with a sonoff basic flashed with tasmota. I can switch on and off via HA and it indicates the status. When I manually turn on or off that switch it does not update in HA.

Here is my MQTT (mosquito add-on):

switch:

  • platform: mqtt
    name: “Test Basic”
    command_topic: "cmnd/DVES_XXXXXX_fb/POWER
    qos: 1
    payload_on: ON
    payload_off: OFF
    retain: true

I’m choosing just to use the fall back topic to better track my switches. Any suggestions would be appreciated.

first problem you need to format your Code
see this easyer to read

platform: mqtt
name: “Test Basic”
command_topic: "cmnd/DVES_XXXXXX_fb/POWER
qos: 1
payload_on: ON
payload_off: OFF
retain: true

Look Like you are reading the
MQTT Client & Fallback Topic
try using the
MQTT Full Topic

image
Whats in my Information Screen

In the light section of HA I have

  - platform: mqtt
    name: "Office"
    state_topic: "stat/office/POWER"
    command_topic: "cmnd/office/POWER"
    payload_on: "ON"
    payload_off: "OFF"
    qos: 0

and my console looks like this

image

see clear as mud

When you say “manually” what are you referring to? Pushing the button on the sonoff?

yes

i am using the switches that are there where Up is off and Down is on (well in new zealand it is
logic will be the same for US guys Up on and down id off

I was responding to this.

And yes I was to manually what status is the manual switch is in

Yes, I have a Sonoff Touch (US) and a Sonoff Basic. When I physically press or publish the button on each, Home Assistant is not updating the status to either ON or OFF concluding that if I view that switch in HA without prior knowledge, I don’t know if it is on or off.

I know that this may be rudimentary but I am pretty early on with HA. As a side note, I have Wemo setup in Tasmota and HA sees it but fails to install or integrate it automatically. That’s for another discussion though.

Thank you for your help!

Are you using discovery?

I’m trying to do this but with using discovery, it would be better to make the switch appear as a binary sensor IMO