I am setting up an alarm system in which an active infrared beam sensor will set off an alarm and notification. The infrared receiver is wired to a Wemos D1 mini flashed with Tasmota and working with Mosquitto mqtt addon. All of this is working fine. The sensors are operating as expected. Tasmota console shows payload on and off as I pass my hand over the beam. There are no errors in the HA logs. The yaml validates. BUT the entity card on the frontend does not effect the change. Here is my config:
I did not use mqtt discovery because I didnât want the sensor to show as a switch. I have triple-checked the wiring etc. Donât know where else to look.
I assume your pasted config does not actually look like that or you would be getting configuration errors from the incorrect indentation. It should be:
Check the entityâs state in Developer Tools > States. If it reports the correct state there but not in the Entity card, then double-check how you configured the card.
If it fails to report the correct state in Developer Tools > States then thereâs a problem with the configuration of the MQTT Binary Sensor.
When I check Dev Tools>states for entity: binary_sensor.courtyard_beam_break it does not report the correct state after applying your config. So the problem must be with the configuration of the mqtt sensor? Any suggestions about where I should be looking?
This is how I have configured the mqtt sensor: Device Name = D1 mini, friendly name = courtyard-beam-break, Module = generic (based on sonoff Basic(1), Topic = courtyard-motion, Template = generic (Switch1, GPIO5)
I did try setting some options like SetOption 1 and SetOption 0. Not sure if that would make a diifference.
In your first post,you stated everything is working fine with the binary_sensor except for the Entity card in the frontend.
What exactly did you mean when you said âAll of this is working fineâ? Did binary_sensor.courtyard_beam_break report its state correctly in Developer Tools > States when using your original configuration, namely this one?
When I said everything was fine I meant that I was getting response from the sensors and it was showing in the mqtt console and the config was valid and not throwing any errors but I had not checked Devtools > state of the entity until you suggested it. The state is not correct. When I listen I get this:
Message 17 received on stat/courtyard-motion/courtyard-motion at 5:23 PM:
Clear
QoS: 0 - Retain: false
Message 16 received on stat/courtyard-motion/courtyard-motion at 5:23 PM:
Detected
QoS: 0 - Retain: false
Message 15 received on stat/courtyard-motion/courtyard-motion at 5:23 PM:
Clear
QoS: 0 - Retain: false
Message 14 received on stat/courtyard-motion/courtyard-motion at 5:23 PM:
Detected
QoS: 0 - Retain: false
So it is working at that point (yay!!!) but the frontend is still not changing. It is, however, now indicating Detected. Odd thing is the on - off are reversed ie. when I break the beam it shows âclearâ and default is detected.
Oh, I missed the part about Switch1 so I guess it is not working. I am using the config that you suggested so Switch1 should show?
but, for whatever reason, Home Assistant isnât seeing that topic. Therefore the configuration I had suggested, which depends on stat/courtyard-motion/SWITCH1, will not work.
If you have another MQTT client handy, like MQTT Explorer, you could use it to determine if anything is (or is not) actually being published to stat/courtyard-motion/SWITCH1. Otherwise, simply use the configuration provided by tom_I (the one that depends on stat/courtyard-motion/courtyard-motion).
EDIT
Out of curiosity, why did you create a Tasmota rule to publish its state to stat/courtyard-motion/courtyard-motion?
TaDa!!! Working. As you suggested I went back to the previous config and it is now working great. Thank you so much for your help. I really wanted this to work.
About the Tasmota rule. This is what I used:
SwitchMode1 1
SwitchTopic 0
Rule1 on Switch1#state=1 do publish stat/%topic%/courtyard-motion DETECTED endon on Switch1#state=0 do Publish stat/%topic%/courtyard-motion CLEAR endon
Rule1 1
I got this from the Tasmota PIR options and tried it when I couldnât get the sensors to even respond. So would this cause the redundant courtyard-motion? If so is there any way to undo that? Like if I used Rule1 0?