igor-podpalchenko / ha-devi-mqtt

Home Assistant Danfoss DeviReg MQTT service
4 stars 1 forks source link

Issue generating devi_config.json when running Discovery #1

Closed 928driver closed 6 days ago

928driver commented 1 month ago

I managed to run the command java -cp ha-devi-mqtt.jar io.homeassistant.devi.mqtt.service.DiscoveryService in both Windows and Raspberry pi OS after installing Java. I filled in the user name and the OTP code from the Devireg App, tested both from Android and iOS.

The script lists all the thermostats that I have but is generating error codes and is stuck in an endless loop, never generating the devi_config.json file.

These are the error messages: After I enter user name, it gives the following messages and one error: 19:17:14.860 [main] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 19:17:14.866 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Cycle

This is part of the messages it is generating when in the endless loop: 22:01:42.315 [pool-8-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a2302c66ce657ba4aa4a2302c66ce65a4a2302c66ce6553586975 22:01:42.317 [pool-7-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a2302c66ce657bf1b13c62417f1a57269b2aeb0b84b3553586975 22:01:42.318 [pool-6-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce651b13c62417f1a571b13c621b13c621b138453586975 22:01:42.368 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 22:01:42.384 [pool-2-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 22:01:42.400 [pool-3-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 22:01:42.416 [pool-4-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 22:01:42.433 [pool-5-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 22:01:42.450 [pool-6-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 22:01:42.466 [pool-8-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1

igor-podpalchenko commented 1 month ago

opensdg_test.tar.gz

Could you check if the host you are running is on the same LAN/WiFi as the devices? Try at different time, it may be a cloud connection problem.

If that does not help - I've compiled the original opensdg test utility. Original URL - https://github.com/Sonic-Amiga/opensdg

It generates the public & private keys and displays output from thermostats, you may use it to fill the configuration file manually. Use "whoami" command inside the utility and "pair" command. Then you could use connect 0, 1, 2 (index of your device).

Let me know, if you managed to solve this. If no - I'll add more tracing info to the Discovery utility. If you know Java, a little bit - discovery code is here, you may debug it. https://github.com/igor-podpalchenko/ha-devi-mqtt/blob/main/src/main/java/io/homeassistant/devi/mqtt/service/DiscoveryService.java

928driver commented 4 weeks ago

Hello @igor-podpalchenko and thank you for taking your time to make this integration for HA and helping me out trying to solve this :)

The thermostats are on the same wifi/lan network as both the window PC and the raspberry pi. I now also tried to run the discovery in WSL Ubuntu just to try out x86 and Linux, but the results are the same.

Unfortunately, I was not able to get the opensdg_test running, I tried Ubuntu, Raspberry OS and Windows.

Here is the complete log from running the discovery: To configure thermostat's access. Download / open Devi application. Go to settings -> Share Home -> OTP code will be generated. Enter this code, when requested. For some reasons, first OTP code usually fails. Click back in mobile app and enter new code. Try entering OTP few times. Enter username (press Enter to use default [ha-user]): 12:28:28.013 [main] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 12:28:28.018 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Cycle Enter OTP: 2015243 12:30:08.755 [main] INFO i.h.b.d.i.GridConnectionKeeper - Last user is gone, disconnecting from Danfoss grid 12:30:08.761 [main] INFO i.h.b.d.i.GridConnectionKeeper - Grid connection closed 12:30:08.765 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 8577d80817679bfa97dd5424cb97afb81a928e0082f705552b1d289a5f6644f Main Bathroom 12:30:08.765 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 0f359ee5b9f8bd0083a95ec9abf20e2054c646e4a78471651629ddc3c632c28 Hallway 12:30:08.765 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 9932a4526c11050bdcbec796a3739df5258da6b0a0b839ff353b19270d95f30 Walk Inn Closet 12:30:08.766 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 304b0a062142ffd23aae964acb2396da528646ed5c457c8c8be88b073deb41f Outside Living Room 12:30:08.766 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 306bde8f607f8d975e36911051ace787725673a6dd58d562310cd9fcaf62f29 Kitchen 12:30:08.766 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 17e43f60fa867923c23fe2b27c743ffbea2e8f20cab0c9432274cc56c9c5a70 Living Room 12:30:08.766 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 507505f61044765df062060efc806fc9ddc7b6dc13998fa880199f98868d83d 2nd Floor Bathroom 12:30:08.766 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: e44d20bc4b3588cb121b16fd2f3e2b23acffd94c6c72217091cdf385da44f7a Entrance 12:30:09.014 [pool-1-thread-1] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 12:30:09.016 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.017 [pool-2-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.019 [pool-3-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.021 [pool-4-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.021 [pool-5-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.022 [pool-6-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 Awaiting query completion 12:30:09.023 [pool-7-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.025 [pool-8-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:09.072 [pool-2-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.080 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.087 [pool-3-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.095 [pool-4-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.104 [pool-7-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.115 [pool-5-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.120 [pool-8-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:09.129 [pool-6-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.075 [pool-2-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.081 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.088 [pool-3-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.096 [pool-4-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.105 [pool-7-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.116 [pool-5-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.120 [pool-8-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.130 [pool-6-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:19.350 [pool-2-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.361 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.827 [pool-3-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.838 [pool-4-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.846 [pool-7-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.856 [pool-5-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.871 [pool-8-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:19.877 [pool-6-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.353 [pool-2-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.362 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.393 [pool-2-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.427 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.829 [pool-3-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.840 [pool-4-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.848 [pool-7-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.857 [pool-5-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.871 [pool-8-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.878 [pool-6-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:29.934 [pool-3-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.968 [pool-4-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.975 [pool-7-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.989 [pool-5-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:29.991 [pool-8-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:30.002 [pool-6-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:39.395 [pool-2-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:39.429 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:39.439 [pool-2-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:39.484 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:39.936 [pool-3-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:39.970 [pool-4-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:39.977 [pool-7-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:40.006 [pool-3-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:40.006 [pool-6-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:40.006 [pool-8-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:40.006 [pool-5-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 12:30:40.070 [pool-4-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:40.071 [pool-7-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:40.203 [pool-8-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:40.203 [pool-5-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 12:30:40.204 [pool-6-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1

igor-podpalchenko commented 4 weeks ago

I've found the bug in the discovery code. Sry. Try to get the latest release (jar or docker) and try again. Just tested on my device, it works fine now.

igor-podpalchenko commented 4 weeks ago

Please keep me posted with your results.

928driver commented 4 weeks ago

I now tried the latest jar file in WSL Ubuntu, but I still get the same results

igor-podpalchenko commented 4 weeks ago

I've added logging in v1.0.2

Here is my discovery log (1 thermostat).

java -cp target/ha-devi-mqtt.jar io.homeassistant.devi.mqtt.service.DiscoveryService To configure thermostat's access. Download / open Devi application. Go to settings -> Share Home -> OTP code will be generated. Enter this code, when requested. For some reasons, first OTP code usually fails. Click back in mobile app and enter new code. Try entering OTP few times. Enter username (press Enter to use default [ha-user]): auto 14:01:17.396 [main] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 14:01:17.397 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Cycle Enter OTP: XXXXX 14:01:42.110 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Failed to receive config: null 14:01:42.119 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Cycle Enter OTP: XXXXX 14:01:57.912 [main] INFO i.h.b.d.i.GridConnectionKeeper - Last user is gone, disconnecting from Danfoss grid 14:01:57.914 [main] INFO i.h.b.d.i.GridConnectionKeeper - Grid connection closed 14:01:57.919 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: YYYYYYYYYYYY Bathroom Awaiting query completion 14:01:58.211 [pool-1-thread-1] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 14:01:58.212 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer YYYYYYYYYYYY 14:01:58.317 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 14:02:08.323 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer YYYYYYYYYYYY 14:02:09.594 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connection established Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_serial_number, value: ZZZZZZZ 14:02:09.600 [SDG socket thread.1] INFO i.h.b.d.i.GridConnectionKeeper - Last user is gone, disconnecting from Danfoss grid 14:02:09.601 [SDG socket thread.1] INFO i.h.b.d.i.GridConnectionKeeper - Grid connection closed Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_hardware_version, value: 3.1 Parsing thermostat data - key: sys_serial_number, value: ZZZZZZZ Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_hardware_version, value: 3.1 Parsing thermostat data - key: sys_firmware_version, value: 1.0.127 Parsing thermostat data - key: sys_serial_number, value: ZZZZZZZ Configuration complete. devi_config.json is generated Parsing thermostat data - key: sys_production_date, value: Mar 5, 2021, 2:07:52 AM Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_hardware_version, value: 3.1 Parsing thermostat data - key: sys_firmware_version, value: 1.0.127 Parsing thermostat data - key: sys_serial_number, value: ZZZZZZZ Parsing thermostat data - key: sys_production_date, value: Mar 5, 2021, 2:07:52 AM Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_hardware_version, value: 3.1 Parsing thermostat data - key: sys_firmware_version, value: 1.0.127 Parsing thermostat data - key: sys_serial_number, value: ZZZZZZZ Parsing thermostat data - key: sys_wifi_connect_ssid, value: Houston Parsing thermostat data - key: sys_production_date, value: Mar 5, 2021, 2:07:52 AM Parsing thermostat data - key: sys_wifi_strength, value: -51 db Parsing thermostat data - key: sys_connection_count, value: 2 Parsing thermostat data - key: sys_hardware_version, value: 3.1

928driver commented 4 weeks ago

I see that you are first receiving the same warning one time: 14:01:58.317 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1

But after that the connection is established. Is it possible that I might be related to having more than one thermostat?

igor-podpalchenko commented 4 weeks ago

You might try to move one thermostat to a different "home" and try. It might be that, as this is async code, I've written it blindly, as I have only one device for testing.

928driver commented 4 weeks ago

I tried to make a new "home" and moved one thermostat to that home. But, still same results, that it is giving the following warning over and over again: Device went offline: Connection refused by grid: 1 This time for the one thermostat instead of them all.

Strange, because I had it working with the https://github.com/Sonic-Amiga/opensdg integration for OpenHAB last year, discovering and adding thermostats...

igor-podpalchenko commented 4 weeks ago

I see a problem in your logs:

PeerID's of all your devices are determined correctly:

8577d80817679bfa97dd5424cb97afb81a928e0082f705552b1d289a5f6644f Main Bathroom 0f359ee5b9f8bd0083a95ec9abf20e2054c646e4a78471651629ddc3c632c28 Hallway 9932a4526c11050bdcbec796a3739df5258da6b0a0b839ff353b19270d95f30 Walk Inn Closet 304b0a062142ffd23aae964acb2396da528646ed5c457c8c8be88b073deb41f Outside Living Room 306bde8f607f8d975e36911051ace787725673a6dd58d562310cd9fcaf62f29 Kitchen 17e43f60fa867923c23fe2b27c743ffbea2e8f20cab0c9432274cc56c9c5a70 Living Room 507505f61044765df062060efc806fc9ddc7b6dc13998fa880199f98868d83d 2nd Floor Bathroom e44d20bc4b3588cb121b16fd2f3e2b23acffd94c6c72217091cdf385da44f7a Entrance

Then, for some reason, the code tries to connect to some odd value: "3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975"

It looks broken, see the "," symbol and it does not match any ID's from the previous list. It might be related to async code, I'll think about how to solve it (it's more related to the library I use than to my code).

What do you get in the log, for a single device bound to home? As you see from my log, it works fine for me.

I've updated a code to v1.0.3 (It includes sleep and more diagnostic logging).

928driver commented 4 weeks ago

I tried to setup the thermostat through a mobile router, phone, thermostat and PC were connected to same, just to get another internet connection and firewall. But same results...

You are right about that the code is trying to contact "3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975" and it is not matching any of the codes of any thermostat. I have edited the codes to not out them online, but you are right that it is not same.

Here is the new log with the last update you made from having only one thermostat in a new "home" that I made. Now is also showing privatekey, I just hide part of it:

To configure thermostat's access. Download / open Devi application. Go to settings -> Share Home -> OTP code will be generated. Enter this code, when requested. For some reasons, first OTP code usually fails. Click back in mobile app and enter new code. Try entering OTP few times. Enter username (press Enter to use default [ha-user]): 15:27:34.217 [main] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 15:27:34.219 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Cycle Enter OTP: 1204514 15:27:39.823 [main] INFO i.h.b.d.i.GridConnectionKeeper - Last user is gone, disconnecting from Danfoss grid 15:27:39.827 [main] INFO i.h.b.d.i.GridConnectionKeeper - Grid connection closed 15:27:39.840 [main] INFO i.h.d.mqtt.service.DiscoveryService - Received DeviSmart thing: 507505f61044765df062060efc806fc9ddc7b6dc13998fa880199f98868d83d Bate Room Home data, phonePeerID: 29fcadXXXXXXXXXXXXXXXXXXXXXXb104a498638c99310e7a90bb80752 privateKey: Connecting to peer: 29FCADXXXXXXXXXXXXXXXXXXXXXX104A498638C99310E7A90BB80752 15:27:40.144 [pool-1-thread-1] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid 15:27:40.149 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 15:27:40.247 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 Awaiting query completion 15:27:50.252 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 15:27:50.325 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 15:28:00.326 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 15:28:00.385 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 15:28:10.387 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 15:28:10.456 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 15:28:20.460 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 15:28:20.527 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 15:28:30.530 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975 15:28:30.597 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1 15:28:40.601 [pool-1-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce657bf1b13c62417f1a5269b2am,n5dd87eb0b84b3553586975

igor-podpalchenko commented 4 weeks ago

Let's do it the other way. I'll release "v1.0.4", you will run it in discovery mode and send me the log to: podpalch@gmail.com I'll try to generate a devi_config.json manually, so you can try the app itself. It will contain fake serial numbers, so MQTT topic structure will not be as expected. You could drop it later.

igor-podpalchenko commented 4 weeks ago

Here you go, replace peerId / privateKey with values from this string: String.format("Home data, phonePeerID: %s privateKey: %s", jsonMap.get("peerId"), jsonMap.get("privateKey"))); And userName with one you entered.

{ "peerId": "your phone ID", "privateKey": "your PK", "houseName": "YourHomeName", "rooms": [ { "serialNumber": "1", "devicePeerID": "8577d80817679bfa97dd5424cb97afb81a928e0082f705552b1d289a5f6644f", "name": "Main Bathroom" }, { "serialNumber": "2", "devicePeerID": "0f359ee5b9f8bd0083a95ec9abf20e2054c646e4a78471651629ddc3c632c28", "name": "Hallway" }, { "serialNumber": "3", "devicePeerID": "9932a4526c11050bdcbec796a3739df5258da6b0a0b839ff353b19270d95f30", "name": "Walk Inn Closet" }, { "serialNumber": "4", "devicePeerID": "304b0a062142ffd23aae964acb2396da528646ed5c457c8c8be88b073deb41f", "name": "Outside Living Room" }, { "serialNumber": "5", "devicePeerID": "306bde8f607f8d975e36911051ace787725673a6dd58d562310cd9fcaf62f29", "name": "Kitchen" }, { "serialNumber": "6", "devicePeerID": "17e43f60fa867923c23fe2b27c743ffbea2e8f20cab0c9432274cc56c9c5a70", "name": "Living Room" }, { "serialNumber": "7", "devicePeerID": "507505f61044765df062060efc806fc9ddc7b6dc13998fa880199f98868d83d", "name": "2nd Floor Bathroom" }, { "serialNumber": "8", "devicePeerID": "e44d20bc4b3588cb121b16fd2f3e2b23acffd94c6c72217091cdf385da44f7a", "name": "Entrance" } ], "userName": "auto" }

igor-podpalchenko commented 4 weeks ago

I have updated the code.

928driver commented 4 weeks ago

I made the devi_config.json and mqtt_config.json files from your help, thank you :)

But I struggle to figure out how run either the plain java or the docker in HA OS. I tried to follow some instructions how to install the docker but I keep getting errors. I never ran any dockers in HA OS before, do you have any tips how to do that?

igor-podpalchenko commented 4 weeks ago

It does not require any specific configuration. Just run it anywhere (it contains java runtime + app):

docker run -v $(pwd)/devi_config.json:/app/config/devi_config.json -v $(pwd)/mqtt_config.json:/app/config/mqtt_config.json -v $(pwd)/auto-discovery-templates:/app/config/auto-discovery-templates podpalch/ha-devi-mqtt

Replace $(pwd) with full path's.

928driver commented 3 weeks ago

I tried some more and now I found out that running dockers in Home Assistant OS is not supported and tricky to find work-arounds for that. So I am now not so sure how I can run this in HA OS.

928driver commented 3 weeks ago

I found some information that one can make and run an add-on in HA from the docker, but I am not sure how to do that.