So, I have a device that has no integration for HA. A very specialized device. I can however connect to said device with my own code and capture current watts being used. Is there a way I could take every 5 minutes or so those watts and via the HA API stuff them into something in HA so that it can convert those watts into a daily kwh value? It’s a very specialized power device that powers 15 or so home theater components and I don’t want to create a new integration.
So, can I create a sensor not tied to any device and stuff those watt values into HA?
Home assistant has restful and command line sensors you could use to get the power periodically. Then it is just a matter of using the Integral helper to convert power to energy. You can then use utility meter helpers to count energy on any cycle you want.
No restful interface, just web with login, security, etc., and a scrape would be necessary. Or, it also has a UDP capability via XML commands to send and XML to be parsed on return.
I don’t want to get the power data from the device, I suspect I’d need to code a new integration and I simply do not wish to, I simply want to push the data into HA. Is that possible? I already have code that has to interface with the devive for other purposes in a complicated theater room. I simply want to leverage that data I already have and push into HA via a trivial API call.
Ok, I will look into the doc for how to extract the info from HA using the doc you noted. Maybe it’s not so bad. Thanks for the links. Yes, didn’t know it converted xml to json. Unfortunately, REST doesn’t work for UDP services. It could be scraped, but likely command line would be easiest if I can use netcat or socat, etc.