birdie1 / victron

Victron bluetooth and serial communication at a python script. With MQTT and HomeAssistant support.
GNU General Public License v3.0
125 stars 16 forks source link

Error after few minutes #24

Open Tyres91 opened 1 year ago

Tyres91 commented 1 year ago

After a few minutes(5-10) i get the follwoing error: `[INFO ] (2023-04-09 11:15:16,504) victron_gatt.py::62 MPPT-Solar: Disconnected! [DEBUG ] (2023-04-09 11:15:16,507) victron_bluetooth.py::252 MPPT-Solar: Will reconnect at 2023-04-09 11:16:16.507228 Exception in thread Thread-2: Traceback (most recent call last): File "/home/heavyreisen/.local/lib/python3.9/site-packages/gatt/gatt_linux.py", line 139, in start_discovery self._adapter.StartDiscovery() File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in call return self._connection.call_blocking(self._named_service, File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking reply_message = self.send_message_with_reply_and_block( dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner self.run() File "/usr/lib/python3.9/threading.py", line 1266, in run self.function(*self.args, **self.kwargs) File "/home/heavyreisen/Downloads/victron/victron.py", line 25, in victron_thread v.connect_disconnect_loop() File "/home/heavyreisen/Downloads/victron/lib/victron.py", line 52, in connect_disconnect_loop self.victron_type.connect_disconnect_loop(self.cmd, self.config['timer']) File "/home/heavyreisen/Downloads/victron/lib/victron_bluetooth/victron_bluetooth.py", line 248, in connect_disconnect_loop if self.connect_loop(): File "/home/heavyreisen/Downloads/victron/lib/victron_bluetooth/victron_bluetooth.py", line 220, in connect_loop manager.start_discovery() File "/home/heavyreisen/.local/lib/python3.9/site-packages/gatt/gatt_linux.py", line 149, in start_discovery raise _error_from_dbus_error(e) gatt.errors.Failed: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. `

Config: `## Add your devices here: devices:

- name: Shunt1

type: smartshunt

protocol: bluetooth-ble

mac: fd:d4:50:0f:6c:1b

- name: MPPT-Solar
  type: smartsolar
  protocol: bluetooth
  mac: C7:F9:7F:61:6E:37

- name: Phoenix1

type: pheonix

protocol: serial

port: /dev/ttyUSB0

devices:

- name: Shunt1

type: smartshunt

protocol: bluetooth-ble

mac: fd:d4:50:0f:6c:1b

timer (in seconds) IN DEVELOPMENT!

timer: retry: 15 bluetooth: connected: 60, disconnected: 60 bluetooth-ble: repeat: 60 serial: repeat: 30

Logging:

possible values:

- syslog

- mqtt

- print

- json

logger: mqtt

If logging is set to mqtt, this section must be filled

Set hass to True if you want support for Homeassistant Discovery

Mandatory: host: 192.168.178.22 port: 1883 base_topic: victron hass: True Optional: username: admin password: 580500 mqtt: host: 192.168.178.22 port: 1883 base_topic: victron hass: True username: xxx password: xxx

Collected enitites by device type:

If you change this, the names must be the same like in the value tables from victron.py

If you use collections it will send whole collection as json instead of individual values.

#

Replace key to name of your device: For example:

collections:

Shunt1:

battery:

- State Of Charge

- ...

#

WARNING: Please do not use collections for protocol bluetooth currently. It will probably not return any values!

# #

POSSIBLE COLLECTION SERIAL:

smartshunt:

device:

- Product ID

- Firmware Version

battery:

- State Of Charge

- Time To Go

latest:

- Voltage

- Current

- Power

- Starter Battery Voltage

- Used Energy

history:

- Deepest Discharge

- Last Discharge

- Average Discharge

- Cumulative Ah Drawn

- Time Since Last Full

- Charge Cycles

- Full Discharges

- Battery Voltage min

- Battery Voltage max

- Synchonisations

- Alarm Voltage low

- Alarm Voltage high

- Starter Battery Voltage min

- Starter Battery Voltage max

- Total Discharged Energy

- Total Charged Energy

phoenix:

device:

- Product ID

- Serial

- Firmware

- Production Date

latest:

- Voltage

- AC Voltage

- AC Current

- Mode

- Status

- Warning

- Alarm Reason

smartsolar:

device:

- Day sequence Number (0..364)

- Product ID

- Serial

- Firmware

- Production Date

latest:

- Voltage

- Current

- Voltage Panel

- Power

- Status

- MPPT Tracker Operation Mode

- Off Reason

- Virtual Load Output

- Error Code

history:

- Energy All Time

- Energy Today

- Energy Today Max

- Energy Yesterday

- Energy Yesterday Max

#

POSSIBLE COLLECTION BLUETOOTH-BLE:

smartshunt:

battery:

- State Of Charge

- Remaining Time

latest:

- Voltage

- Starter Voltage

- Current

- Power

- Used Energy

collections:`