Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MQTT + Autodiscovery instead of a custom component for Home Assistant #13

Open
Hypfer opened this issue Mar 27, 2020 · 4 comments
Open

Comments

@Hypfer
Copy link

Hypfer commented Mar 27, 2020

To decouple the Home Assistant Host from the host with the USB Device, it might make sense to utilize the cover.mqtt integration instead of having a custom component.

The duofern.start_pairing and duofern.sync_devices custom services wouldn't be possible though.
We could probably map them to switch.mqtt entities

@gluap
Copy link
Owner

gluap commented May 21, 2020

@Hypfer I have recently looked into mqtt for another project and feel that I now could implement this with relative ease. Do you have experience with how to provide the autodiscovery facilities? Looking at https://www.home-assistant.io/docs/mqtt/discovery/ it appears that a json dictionary containing hass configuration posted to the right topic is sufficient.

@Hypfer
Copy link
Author

Hypfer commented May 21, 2020

Yep. Exactly

Here's an example for the autoconf payload of a vaccum.mqtt device including device information

https://github.com/Hypfer/Valetudo/blob/bff36388e9aacef0e3669c904a04dbf837710b35/lib/MqttClient.js#L216-L244

And here's an older one for sensor.mqtt without device information

https://github.com/Hypfer/Cybele/blob/444bae601479b0b420f580ee3fbfd5236e264658/lib/devices/MiKettle/MiKettleMqttHandler.js#L21-L30

And another one. This time for cover.mqtt which would also be used here
I've hacked this one together to control my Schellenberg Cover

{
   "name": "Schellenberg Markisenantrieb",
   "unique_id": "schellenberg_markisenantrieb",
   "device": {
	"manufacturer": "Schellenberg",
	"model": "Funk-Markisenantrieb Premium",
	"name": "Schellenberg Markisenantrieb",
	"identifiers": ["schellenberg_markisenantrieb"]
   },
   "command_topic": "nodered/cover/schellenberg_markisenantrieb/command",
   "state_topic": "nodered/cover/schellenberg_markisenantrieb/state"
}

Topic: homeassistant/cover/schellenberg_markisenantrieb/config
It's extremely basic and works in optimistic mode but it works

@rakaandro
Copy link
Contributor

Z-Wave is also currently being "converted" to MQTT. Maybe there are code examples. MQTT + autodisovery + HACS installation would be great. Unfortunately I am not a programmer, but would help testing. I have a Rademacher garage door, a switchable socket and radio cover.

@realbuxtehuder
Copy link
Contributor

Hi @gluap, thanks for sharing your great work here on github!
Are you still working on the MQTT feature?
(In the past I used FHEM to connect my DuoFern Rollos via MQTT to a NodeRed installation, but since a few weeks FHEM can't establish the MQTT connection anymore. I think your pyduofern would be a much better and slender solution)
Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants