Just let me know if and when you need testing, am happy to help
Well Ive cleaned up the code and published a PR… Its a lot more convoluted than I hoped… and home DIY gets in the way… lets see how it goes
I will pull and test and let you know
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?
Do you know if hassio installs a firewall? I use ufw (uncomplicated firewall) and that easy to setup but I dont know which fw haasio has installed…
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
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.
let me know how this goes
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.
Ok…I think I’ve made some progress. I found this…
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:
- platform: command_line name: EnergyMon command: "python3 /config/filename.py"
After restarting, I checked the logs and I’m getting:
Fri Nov 22 2019 15:49:36 GMT+0000 (Greenwich Mean Time) Timeout for command: python3 /config/filename.py
so something’s not working/connecting and I’m stuck once again, albeit further forward than before!
ive never used hass.io…
Can you not get to the command line?
It’s supposed to be possible…
but I cannot get in following these instructions, so I’m locked out and not knowledgeable enough to get in!
More info after trying again, maybe there’s something that you can identify in this…
Command executed: python3 /config/filename.py: 1 Traceback (most recent call last): File "/config/filename.py", line 7, in <module> sock.bind(('0.0.0.0', 9761)) OSError: [Errno 98] Address in use
this is because the code is running in HA too… Take out the lightwaverf_energy yaml lines and try again
From reading the link, if you install this add on you can ssh (or use putty on a windows PC) and execute the script from the command line.
WRT executing the script, copy the lines of code into a file (with the extension .py) and then run it using python yourfilename.py
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
Doesnt make sense to me… Have you tried running the command on your PC instead? Be good to validate that the UDP packets are being sent by the hub
Good call! I’ve run in on Windows and it’s not receiving any data…drat…I’ll have to investigate further. Thanks for your help this far!!
Is your lightwaverf link and the PC/Hassio on the same “physical” network.
yep, same network
(Sorry for the delay)
Sorry dont know, im guessing firewall/networking issue… Once you get the python to work the component will also work.