kvj / hass_openwrt

Home Assistant integration with OpenWrt devices
MIT License
105 stars 19 forks source link

Support PoE sensor #8

Open andyboeh opened 1 year ago

andyboeh commented 1 year ago

I have two OpenWrt-based managed switches with 24/48 PoE ports. I would like to monitor the power consumption within Home Assistant, thus it makes a lot of sense to integrate them into this project. My switches are Realtek-based and require the realtek-poe package to support PoE. This package provides a ubus call poe info command to get, amongst others, power statistics.

Is this enough to create a HA sensor for it?

Thanks

AlexStragies commented 1 year ago

Recent versions of OpenWrt include versions of realtek-poe, that can manage the POE-output per port (ubus call poe manage '{ "port": "lan4", "enable": false }'. Those ports could thus be displayed as switches.

I currently use a hacky shell-script to inject/read messages from/to MQTT to control POE-Power on OpenWrt devices from HA, so supporting this use-case in hass_openwrt would cut down on the crude hacks I currently maintain for my environment.

These next few days I'm a bit busy, but I'll look into maybe coding a (rough prototype) PR starting October. If anyone gets around to it before me, I'd be happy to test anything on some of my non-prod devices.

Oh, and thanks already for having created this custom_component. It's already very useful!