Achronite / mqtt-energenie-ener314rt

MQTT interface for Energenie ENER314-RT add-on board for the Raspberry Pi, designed for use by Home Assistant.
MIT License
13 stars 5 forks source link

Any thoughts on how to deal with OOK devices for MQTT Discovery? #7

Closed Achronite closed 1 year ago

Achronite commented 1 year ago

I'm currently developing a solution for MQTT discovery (Issue #1). It will work very well for FSK, aka 'Monitor' or 'Control & Monitor' devices as they get auto-added to an internal deviceList. The question is should I be trying to support OOK aka 'Control Only' devices with MQTT discovery?

If support were to be added there would need to be some way of getting or storing an OOK device list...

Any thoughts anyone? @mprocte1

Achronite commented 1 year ago

Current thought...

Options

  1. Populate discovery config topic(s) when sending back responses
  2. Build discovery topics periodically
  3. Create a 'teaching' application to add OOK devices, store results in a file
Option Pros Cons
1 Will add OOK devices by default Possible poor performance (if building on every msg)
2 Would need config files for OOK devices Most performant
3 Still needs config file for OOK, maybe implement after 2? Most performant
mprocte1 commented 1 year ago

@Achronite I don't think it's going to be possible to easily achieve this automatically, as the OOK switches don't transmit any messages. Plus, the ener314rt (specifically the library?) only sends OOK messages and doesn't listen for them e.g. when a remote control button is pushed.

BTW ... I found the existing mechanism of adding it to the mqtt section in configuration.yaml more than adequate.

dansgalaxy commented 1 year ago

I think option 2/3 are definitely preferable, after all one of the main reasons for local control is performance vs cloud.

It'd be a huge bonus if devices can be discovered automatically in HA and avoid manual config of devices there. Even if there needs to be some input on the teaching side on the Pi.

In an ideal world it'd be great to have a 'passive learning' option so I can run the ener314-rt on a pi in tandem with my existing Energenie Hub and have it learn what devices are around based on the commands the hub is sending, and then when I see all my devices are showing under MQTT in HA I know it's all good to remove the Energenie hub. This would potentially have the benefit of enabling users to easily use both Cloud and Local control as it presumably keeps the device zone IDs et el - theoretically could even connect to the mihome API and loop through devices issuing an on/off command to cause the command to be sent from the Hub, which the pi can then see...

Alternatively a simple script on the pi which I can use to reliably generate the zone ID etc, and guide the user through the process eg. Select device you're adding from list: 2 > Now press button until it flashes > Command being sent... Press Y when flashing stops > Paired successfully! > Add another device?

Achronite commented 1 year ago

Plus, the ener314rt (specifically the library?) only sends OOK messages and doesn't listen for them e.g. when a remote control button is pushed.

In an ideal world it'd be great to have a 'passive learning' option so I can run the ener314-rt on a pi in tandem with my existing Energenie Hub and have it learn what devices are around based on the commands the hub is sending

Unfortunately the 'Control only' devices use a different radio encoding 'OOK' to send command to them to that used for the monitor devices 'FSK'. The ENER314-RT can only listen in either OOK OR FSK mode, so it won't be possible to do this