zivillian / enverproxy Goto Github PK
View Code? Open in Web Editor NEWforked from https://gitlab.eitelwein.net/MEitelwein/Enverbridge-Proxy
forked from https://gitlab.eitelwein.net/MEitelwein/Enverbridge-Proxy
Some nice thing i would like to share.
I had the Python-script running in Docker + a MQTT-container beside it for a few days and worked quite good. But it felt a bit 'bulky' for me as i don't use MQTT anywhere else. For monitoring my panels i had to run two containers. Most of my home automation stuff i do in Node-RED so i thought: why not try to port the code of this project to Node-RED.
You can find the JavaScript-code here: https://gathering.tweakers.net/forum/list_message/71502554#71502554
Backup link: https://gist.github.com/ThinkPadNL/4dd4e000d94d714a1b62f9ab9530d41e
The code is 'static', as in: you will have to define the inverters in the code by yourself. I used HexEd.it to work through the Enverbridge datapackets (sniffed by Wireshark). Using a forEach method would be nicer (as the inverter data is stored in the package at fixed distances) but as i am not a programmer this was quite complex for me. I only have a few panels, so searching the right bytes and defining them by hand in the script was OK for me.
This is not really a issue, so i will close it again, but i thought it would be nice to share it here. Maybe it is useful for someone.
The script seems to crash with the message ValueError: invalid literal for int() with base 10: 'aa998a57'
Complete logging:
2022-04-30 18:28:10,999 - Envertec Proxy - INFO - Starting server (v1.3)
2022-04-30 18:28:10,999 - Envertec Proxy - INFO - Starting mqtt loop
2022-04-30 18:28:11,000 - Envertec Proxy - INFO - mqtt loop started
2022-04-30 18:28:11,000 - Envertec Proxy - INFO - Entering main loop
2022-04-30 18:32:22,647 - Envertec Proxy - INFO - Inputready: [<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 1898)>]
2022-04-30 18:32:22,647 - Envertec Proxy - INFO - Entering on_accept
2022-04-30 18:32:22,648 - Envertec Proxy - INFO - ('192.168.6.46', 49157) has connected
2022-04-30 18:32:23,048 - Envertec Proxy - INFO - New connection list: [<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 1898)>, <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.17.0.15', 1898), raddr=('192.168.6.46', 49157)>]
2022-04-30 18:32:23,048 - Envertec Proxy - INFO - Entering main loop
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Inputready: [<socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.17.0.15', 1898), raddr=('192.168.6.46', 49157)>]
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Main loop: 982 bytes received from ('192.168.6.46', 49157)
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - 982 bytes in on_recv
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Data received as hex: 6803d66810049002084400000000000000000000aa998a5722023c320000000179ec18a43a5232000240000000000000000000001112460322023bd5000000011924188e3a2931fe46dc0500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000516
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Data is coming from a client
2022-04-30 18:32:23,050 - Envertec Proxy - INFO - Processing Data
Traceback (most recent call last):
File "/data/app/./enverproxy.py", line 315, in <module>
server.main_loop()
File "/data/app/./enverproxy.py", line 95, in main_loop
self.on_recv()
File "/data/app/./enverproxy.py", line 253, in on_recv
self.process_data(data)
File "/data/app/./enverproxy.py", line 212, in process_data
response = self.extract(datainhex, wr_index)
File "/data/app/./enverproxy.py", line 191, in extract
if int(d_wr_id) != 0:
ValueError: invalid literal for int() with base 10: 'aa998a57'
2022-04-30 18:32:23,654 - Envertec Proxy - INFO - Starting server (v1.3)
Most of my homelab stuff is running in Docker. I was trying to create a Docker image for this project, but so far i cannot get it running. This is the Dockerfile i made:
FROM python:3.9-alpine
RUN apk --no-cache add git
RUN pip3 install paho-mqtt
RUN git clone https://github.com/zivillian/enverproxy.git /data/app
RUN ls -a /data/app
RUN sed -i "s|/etc/enverproxy.conf|/data/app/enverproxy.conf|g" /data/app/enverproxy.py
WORKDIR /data/app
EXPOSE 1898
CMD ["./enverproxy.py"]
ENTRYPOINT ["python3"]
The image builds succesfully, but when i try to run a container based on this image, i get this error:
Traceback (most recent call last):
File "/data/app/./enverproxy.py", line 309, in <module>
server.connect_mqtt(config['enverproxy']['mqtthost'], config['enverproxy']['mqttuser'], config['enverproxy']['mqttpassword'], int(config['enverproxy']['mqttport']))
File "/data/app/./enverproxy.py", line 69, in connect_mqtt
self.mqtt.connect(host, port)
File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/local/lib/python3.9/socket.py", line 844, in create_connection
raise err
File "/usr/local/lib/python3.9/socket.py", line 832, in create_connection
sock.connect(sa)
OSError: [Errno 99] Address not available`
I have port 1898 exposed in the container.
Any ideas how to get this working in Docker?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.