Ive just cobbled together a Sensor listening for the LightwaveRF energy Monitor output. The platform contains two sensors (Current Usage (W) and Current Day Usage (kWh)…
Before I clean it up and submit a PR Id like some testers!!!
Hey there, thanks for the comment. Yes I am in the process of cleaning up the code and trying to publish it as part of the HA component itself but the process is frankly a bit of a pain… … Ive also heard/read/commented on that it takes ages for stuff to get published but I’ll perserve
Just gotten back from hols, kids , diy getting in the way… but I’ll get to it soon…
I have installed this in Hassio but I can’t seem to find out how to open the port on my raspberry pi 4. I can ssh into hassio but I can’t find out how to ssh into the host in order to update the ports. Can anyone guide me please?
Ok, I’ve found out that the hassio installation on the raspberry pi has all ports open as standard so it must be an issue with my config. I set it up as per the instructions (which do look a little inconsistent with other config settings). In my configuration.yaml I have:
lightwaverf_energy:
scan_interval: 30
But this isn’t set up as any particular entity type, could that be the issue?
The yaml is correct. The reason why you dont see any entity types is because the platform( I think thats what they call it) , generates them at runtime… It generates two sensors.
try this piece of python … Its basically listens for messages from the lWRF energy sensor (via the link).
import json
import logging
import socket
import time
data = None
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 9761))
sock.settimeout(30.0) # Wait a Max of 30 seconds
while True:
try:
print("Waiting for data from LWRF Energy Device")
data, _ = sock.recvfrom(1024) # buffer size is 1024 bytes
print("Data received from LWRF Energy %s " % data)
except socket.timeout as ex:
print("No data received ")
run it using python filename.py
It should return some data within 30s (usually comes every 10 seconds). if you dont receive any data then its likely a network issue… The packets are UDP and dont travel through routers other subnets well.
Thanks for your support, however I don’t know how to run this. I’m assuming I save it as a .py file on my raspberrypi and then run it using the cli. The issue I have is that i’m running home assistant through hass.io which I believe is a docker installation and I have no access to the raspberry pi that the hass.io installation is running on. I can only get to/ssh into the docker container itself.
I don’t have the level of understanding to allow me to try different things. I’ve got this far by closely following instructions but haven’t found anything about this sort of thing/obstacle.
so I saved your code snippet as filename.py (couldn’t think of a better name!), put it in /config using the Hassio configurator add on and then set up the sensor as:
Hi…removing the lines and restarting has no effect. The error message is identical.
I have the ssh add-in, but it ssh’s into the container, not the host and the container cli is a cut down version where you have limited options
Regarding the script…that’s exactly what i did