I have set up an Esp8266 board with a motion sensor and it works with EspEasy ( it shows a one when I refresh the page whilst waving my hand in front of it ). I have tried linking it to home assistant using MQTT but for some reason, it only says “unavailable”. I could really use some help. Thanks!
Here are some screenshots:
First, a couple of friendly pointers:
- You don’t have to bother obscuring 192.168… addresses as they are not route-able over the internet.
- Please don’t post screenshots of your config. It makes it difficult to re-use in a reply. See point 11 here for how to format pasted code correctly.
Now on to your problem:
I suspect your binary sensor mqtt state topic is incorrect but you don’t show what %sysname%
or %tskname%
or %valname%
resolve to in your ESPEasy. So I can’t tell you anything other than it should be:
state_topic: "%sysname%/%tskname%/%valname%"
(replace %...name%
with the actual names in your ESPEasy)
Where did you get sensor/MotionSensor/Motion
?
You can use a client like MQTT.Fx to see what your sensor topic is if you are not sure what these values are.
First of all, thanks for the pointers and for spending the time to reply. It was very helpful being new to all of this.
Now, I think I used the right values for my topic but I’ll post some screenshots anyway:
This is where I got “sysname” from.
And this is where I got “tskname” and “valname” from.
I have also tried replacing “%sysname%/%tskname%/%valname%” with the actual values in the EspEasy config, still without success.
I setup mqtt.fx to test everything but whenever I press “connect”, it shows the error “not authorized to connect”:
This is the setup:
Thanks again!
Which MQTT broker are you using?
Does it require a password?
If so you will need to add that under User Credentials.
The other client that some find easier to use is mqttExplorer
That did it! I added a password and username in my mosquitto broker config as well as in EspEasy and it seems to work now. Thank you so much!