Has anyone managed to get this to be stable, especially with a configuration of GEM → Dashbox → HA? I have that setup and I have a GEM sending to Dashbox using Bin32-NET format. That’s working fine at the dashbox. I have this in my configuration.yaml
Setup Brultech GreenEye integration
greeneye_monitor:
port: 8001
monitors:
- serial_number: “XXXXXXXX”
channels:
number: 1
name: total_power
voltage:
- number: 1
name: house_voltage
If I do a capture on the network I can see that the Dashbox is delivering TCP packets to port 8001 as requested. I’ve parsed the packets myself and they are valid Bin32-NET packets according to the Brultech specs. But I can’t get HA to read these. I get a ton of log entries like this:
Logger: greeneye.monitor
Source: /usr/local/lib/python3.10/site-packages/greeneye/monitor.py:431
First occurred: March 3, 2023 at 2:28:42 PM (8253 occurrences)
Last logged: 9:21:42 AM
Bad logger message: Exception while calling the listener! ((AssertionError(),))
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 429, in _consumer
await self._listener(message)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 522, in _handle_message
await self._add_monitor(serial_number, message.protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 536, in _add_monitor
await self._set_monitor_protocol(monitor, protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 546, in _set_monitor_protocol
await monitor._set_protocol(protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 292, in _set_protocol
await self._sync_with_settings(self._protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 295, in _sync_with_settings
settings = await get_all_settings(protocol, self.serial_number)
File “/usr/local/lib/python3.10/site-packages/greeneye/api.py”, line 61, in get_all_settings
return await f(None)
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/api.py”, line 83, in send
return api.receive_response(protocol)
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/api.py”, line 70, in receive_response
return self._parse_response(protocol.receive_api_response())
File “/usr/local/lib/python3.10/site-packages/greeneye/api.py”, line 68, in _parse_all_settings
assert response.startswith(_ALL_SETTINGS_RESPONSE_PREFIX)
AssertionError
I don’t really understand where it’s going wrong. I also got a couple of messages like this:
Logger: greeneye.monitor
Source: /usr/local/lib/python3.10/site-packages/greeneye/monitor.py:431
First occurred: 9:21:48 AM (2 occurrences)
Last logged: 9:21:48 AM
Bad logger message: Exception while calling the listener! ((ProtocolStateException(),))
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/api.py”, line 88, in call_api
yield send
File “/usr/local/lib/python3.10/site-packages/greeneye/api.py”, line 61, in get_all_settings
return await f(None)
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/api.py”, line 83, in send
return api.receive_response(protocol)
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/api.py”, line 70, in receive_response
return self._parse_response(protocol.receive_api_response())
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/protocol.py”, line 296, in receive_api_response
response = bytes(self._api_buffer).decode()
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xfe in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 429, in _consumer
await self._listener(message)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 522, in _handle_message
await self._add_monitor(serial_number, message.protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 536, in _add_monitor
await self._set_monitor_protocol(monitor, protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 546, in _set_monitor_protocol
await monitor._set_protocol(protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 292, in _set_protocol
await self._sync_with_settings(self._protocol)
File “/usr/local/lib/python3.10/site-packages/greeneye/monitor.py”, line 295, in _sync_with_settings
settings = await get_all_settings(protocol, self.serial_number)
File “/usr/local/lib/python3.10/site-packages/greeneye/api.py”, line 60, in get_all_settings
async with call_api(_GET_ALL_SETTINGS, protocol, serial_number) as f:
File “/usr/local/lib/python3.10/contextlib.py”, line 217, in aexit
await self.gen.athrow(typ, value, traceback)
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/api.py”, line 90, in call_api
protocol.end_api_request()
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/protocol.py”, line 307, in end_api_request
self._expect_state(
File “/usr/local/lib/python3.10/site-packages/siobrultech_protocols/gem/protocol.py”, line 327, in _expect_state
raise ProtocolStateException(actual=self._state, expected=expected_state)
siobrultech_protocols.gem.protocol.ProtocolStateException: Expected state to be RECEIVED_API_RESPONSE, or SENT_PACKET_DELAY_REQUEST; but got SENT_API_REQUEST!
Interstingly, the invalid start byte that the integration is complaining about is 0xfe which is the correct first byte of a Bin32-NET packet.
Not sure what to do next to troubleshoot this. Any suggestions?
Thanks