cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
110 stars 18 forks source link

[Feature Request] Incorporate Enclosure plugin info #85

Open tankdeer opened 2 years ago

tankdeer commented 2 years ago

First off, awesome plugin. Thanks.

I, like many, am using the Enclosure plugin to control, in my case, several LEDs controlled by GPIO pins on the pi. I have a couple manually created MQTT lights in Home Assistant that allow me to control them by publishing Gcode commands to octoPrint/hassControl/commands, and it works ok. The problem is, there is no topic to subscribe to to get the state, so the state is always "optimistic", which is not ideal. Additionally, Gcode commands are only processed when connected to the printer, but most of my lights don't rely on a printer connection

I know you've done similar with other plugins, so if it's possible to incorporate the information from Enclosure as well, that would be awesome.

It doesn't necessarily need to have discovery enabled, as I realize there are a lot of different configuration options with Enclosure, so it might not be practical to have lights/fans created automatically, and that's fine. If there's a state topic for each configured GPIO, I would think that might be enough for everybody to configure lights/fans/etc in Home Assistant as needed. (Though I am no expert)

Cheers

cmroche commented 2 years ago

It's an interesting idea, but I think it would require some kind of configuration in the plugin too to decide which GPIO states to update since it's hard to know what is connected and could results in a lot of messages over MQTT if say one of those pins was a data pin for instance.

tankdeer commented 2 years ago

Enclosure has a configuration obviously. In that, you define what each GPIO pin you care about does. I'm not sure if you can read the config of another plugin or not, but if so, that might be an option