Giter VIP home page Giter VIP logo

pylontomqtt's Introduction

PylonToMQTT

Jakiper server rack Lithium battery to MQTT publisher

Buy Me A Coffee

Hits

The PylonToMQTT publisher will read data from your Jakiper Battery Bank using the Pylontech protocol via the RS232 console port and publish the data to a MQTT broker. This allows you to integrate other MQTT subscriber applications like HomeAssistant, NodeRed, InfluxDB and Grafana.

The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or implied.

Please refer to the PylonToMQTT wiki for more information.

Support for the US2000 Pylontech batteries can be found at tomascrespo/pylon2mqtt.

License


 Copyright (c) 2022

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

pylontomqtt's People

Contributors

graham22 avatar kwtalley avatar tclausing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pylontomqtt's Issues

Errors in paho.mqtt

When I start the script I get the following errors:

Command
python3 pylon_to_mqtt.py --pylon_port /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_B0001B3W-if00-port0 --baud_rate 9600 --mqtt_host [MY_IP] --mqtt_port [;MY_PORT] --mqtt_root SmartHome/Jakiper

Error message:
Traceback (most recent call last):
File "pylon_to_mqtt.py", line 1, in
from paho.mqtt import client as mqttclient, error_string
ImportError: cannot import name 'error_string' from 'paho.mqtt' (/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/init.py)

Only get "online", no data

I don't know what I am doing wrong. I flashed the ESP32 twice already. Connected RS323-TTL adapter, connected Pace BMS via RS323. However, I only ever get "Online" on PylonToMQTT/LVTOPSUN/tele/LWT (LVTOPSUN is the name of my battery that has a Pace BMS in it sending Pylon formatted data). The Pace BMS is the same as in the Jakiper batteries. Do not get any other data. Even using MQTT Explorer to listen. Using Mosquitto broker in Home Assistant.

What data should I receive with battery disconnected?

ValueError: invalid literal for int() with base 16: b'\x00\x80\x80\x80'

Hi! First thing congratulations for this great project! As far as I know your software is for Jakiper but it will work with a Pylontech US2000B, isn't it?

I am trying to communicate my Raspberry 3B+ with my rack of 2 Pylontech US2000B by console port (RS232) using your software. Previously I had used ICC to communicate with my batteries, and batteryview software also works, so I think my cable is working perfectly.

I have tried your software as mentioned in point 4 of your wiki (Adding PylonToMQTT to an existing system). I have tried command line and docker container with the same result. It publish only a topic in my MQTT server, /PylonToMQTT/Main/tele/LWT=Online, but nothing more, and logut this error:

023-04-04 08:16:47,503:INFO:PylonToMQTT:pylon_mqtt starting up... 2023-04-04 08:16:47,535:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0 2023-04-04 08:16:47,536:INFO:PylonToMQTT:baud_rate = 9600 2023-04-04 08:16:47,537:INFO:PylonToMQTT:rackName = Main 2023-04-04 08:16:47,537:INFO:PylonToMQTT:mqttHost = 192.168.2.245 2023-04-04 08:16:47,538:INFO:PylonToMQTT:mqttPort = 1883 2023-04-04 08:16:47,538:INFO:PylonToMQTT:mqttRoot = PylonToMQTT 2023-04-04 08:16:47,539:INFO:PylonToMQTT:mqttUser = tomascrespo 2023-04-04 08:16:47,539:INFO:PylonToMQTT:mqttPassword = ********** 2023-04-04 08:16:47,540:INFO:PylonToMQTT:publishRate = 5 2023-04-04 08:16:47,540:INFO:PylonToMQTT:sok = False 2023-04-04 08:16:47,541:INFO:PylonToMQTT:Connecting with clientId=tomascrespo_mqttclient_267 2023-04-04 08:16:47,542:INFO:PylonToMQTT:Connecting to MQTT 192.168.2.245:1883 2023-04-04 08:16:47,546:INFO:PylonToMQTT:MQTT connected OK Returned code=0 2023-04-04 08:16:47,547:INFO:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/# 2023-04-04 08:16:58,389:ERROR:PylonToMQTT:Failed to process response! 2023-04-04 08:16:58,390:ERROR:PylonToMQTT:invalid literal for int() with base 16: b'\x00\x80\x80\x80' Traceback (most recent call last): File "pylon_to_mqtt.py", line 235, in periodic number_of_packs = pylontech.get_pack_count().PackCount File "/support/pylontech.py", line 149, in get_pack_count f = self.read_frame() File "/support/pylontech.py", line 143, in read_frame f = self._decode_hw_frame(raw_frame=raw_frame) File "/support/pylontech.py", line 127, in _decode_hw_frame assert got_frame_checksum == int(frame_chksum, 16) ValueError: invalid literal for int() with base 16: b'\x00\x80\x80\x80' 2023-04-04 08:17:09,418:ERROR:PylonToMQTT:Failed to process response! 2023-04-04 08:17:09,418:ERROR:PylonToMQTT:invalid literal for int() with base 16: b'\x00\x80\x80\x80'

Any clue?

ESP32 - MAX232 connection

Hi,
first of all, many thanks for this project and your efforts.
Basically I just want to let you know that the MAX232 rx / tx are wired up wrong in the given image, at least with the two MAX232 I have tested.
The MAXs RX PIN needs to be connected the RX PIN of the ESP32, same for the TX Pin.
The normally used tx -> rx connections applies not to the input of the MAX.

Hope this helps.

5 second timeout on serial port

Every command to a battery takes 5 seconds because you use readline(). Every response from a battery ends with CR, not LF. Wouldn't it be better to use read_until(b'\r') instead?

That said, I have learned a lot from your project because of its completeness. Thank you!

Pack2, Pack3, etc

I now find data from Pack1 in Mosquitto.
How do I also get Pack2? What am I missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.