Hello.
Please tell me how to make a binary sensor for online identification of my device in OpenWRT?
There is an mqtt topic that sends openWRT registration:
I saw your post in Discord, I didn’t know how to answer it. I still don’t.
I don’t think any of what you shared has any info about an MQTT broker or the topic needed or anything, so there is nothing I can add really.
This tool can help you set up stuff in MQTT:
Troubleshooting MQTT? MQTT-Explorer can help you be successful!
If you have Add-ons available, try adding this Add-on repository to your Add-on list. GitHub - GollumDom/addon-repository.
Other that that you need to figure out the topic based on your software, have that software sign into the broker, and send the broker whatever topic. Then something on the other end has to be setup, probably HA to watch the topic and do something with it.
See the MQTT documentation in the HA docs, theres a lot of it.
Unfortunately, this does not suit me, since openwrt is located outside my local network, and in another city. And it has a gray dynamic IP address .
It sends a copy of the log to an external mqtt broker, in one topic. And my local Mosquitto is configured with an external mqtt server in bridge mode.
I tried to do it this way, but HomeAssistant complains that it’s wrong:
I’ve been using this past year with no problem other than it becomes unresponsive every few days so I have HA restart early each morning. I also use fast connect on Openwrt as I have a router on each floor. I then use an automation to turn the binary sensor to off for the previous router when as soon as it picks it up on new router as it was faster than waiting for it to go off by itself.
I only use it for a few devices.
It doesn’t complain anymore, but in the binary sensor state it says “unknown”
All my sensors are placed in a file: /homeassistant/includes/mqtt.yaml
In configuration.yaml I have written: mqtt: !include includes/mqtt.yaml
Well, if your state topic is correctly “secret1/secret2/router/lan/ROOter/syslog”, as in MQTT Explorer, the only reason I see would be that the values sent contains hidden characters (e.g. a carriage return)
@piciolog If weird characters are your problem, you could create an MQTT sensor with the topic contents as its state, then a template binary sensor that looks for substrings in that, if you don’t care about the MAC:
{{ 'on' if 'authenticated' in states('sensor.artem')
else 'off' if 'disassociated' in states('sensor.artem')
else this.state }}
I followed your advice.
Installed wifi-presence on my router.
Set up mqtt.
But it only sends me online or offline information of the router itself.
Please tell me how I can make it send me information about connecting and disconnecting devices?
I read there that you need to register all devices in a JSON file, but I didn’t understand where to put it and how to launch it.
The router sends only its status, it itself sends connections and disconnections of devices with MAC addresses.
You have separate topics with MAC addresses, but I don’t.