andrewjfreyer / monitor

Distributed advertisement-based BTLE presence detection reported via mqtt
1.65k stars 194 forks source link

[feature request] Support HA MQTT Discovery #241

Open blysik opened 5 years ago

blysik commented 5 years ago

Hi! Great tool! Just starting to use it.

It would be awesome if you could support HA MQTT Discovery, as outlined here: https://www.home-assistant.io/docs/mqtt/discovery/

andrewjfreyer commented 4 years ago

I've been working on this, especially since the setup for HA's growing userbase is becoming too complex.

heisenberg2980 commented 3 years ago

I agree, this feature would be awesome, have you got any update?

genebean commented 3 years ago

This would be really nice! It seems like if some of the info that is already collected could be directed to a separate topic that could then be referenced as a discovery topic in HA it might "just work" ... is there anything we could do to help you out on this @andrewjfreyer ?

CaCu15 commented 3 years ago

@genebean Not sure if this helps: I'm currently working on a Node Red Flow to add HA MQTT discovery as well as some other additional logic on top of monitor.sh. Inspired by Monitor-Appdaemon-App I started to create this because: a) Node Red & MQTT are the backbone of all my automations (I hate YAML automations) b) I'm not using App Daemon at all and I want to avoid the use of to many technologies

It's still work in progress, no documentation available at the moment and I'm sure there are a lot of bugs in it, but current features are:

If you are interested I can share the flow with you.

genebean commented 3 years ago

Thanks @CaCu15! I’m happy to check it out. Any chance what you’re doing would help with #375? My monitor.sh is in my office and MQTT is at home (the two are linked via ZeroTier). Sometimes the link between them drops and I’d like to be able to have Node-RED trigger updating HA with the current state of affairs.

CaCu15 commented 3 years ago

@genebean: I need to fix some bugs & write some documentation, then I can provide the flow in a repo. Hope I can finish this during the next week.

Concerning #375: Sending monitor.sh an MQTT message to the topic monitor/scan/KNOWN DEVICE STATES triggers a reporting for all known devices from all monitor.sh instances. This works for me. So it should be easy to use something like this node https://flows.nodered.org/node/node-red-contrib-mqtt-connection-check to trigger an update messages for all devices if MQTT become available again.

I could send messages with the current state of each device from the node red flow as well (I'm keeping track of the state there), but because the communication of the node red flow with monitor.sh is based on MQTT as well this information will be outdated if the MQTT communication is not working.