MickMake / GoSungrow

GoLang implementation to access the iSolarCloud API updated by SunGrow inverters.
https://mickmake.com/
GNU General Public License v2.0
184 stars 48 forks source link

GoSungrow doesn't like mDNS names #83

Open Paraphraser opened 1 year ago

Paraphraser commented 1 year ago

problem summary

I've come across a problem when trying to configure GoSungrow to send MQTT messages to a broker running on a host identified by its multicast DNS name.

The results are summarised in the following table:

table

In words, assume a broker is reachable via the following:

mosquitto_pub is able to publish MQTT messages to the broker via any addressing mechanism, whereas GoSungrow can only use the broker's IP address or fully-qualified domain name.

If GoSungrow tries to reach the broker via its multicast DNS name, it fails with the following error:

Error: network Error : dial tcp: lookup sec-dev.local on 192.168.132.55:53: no such host

192.168.132.55 is a local DNS server authoritative for my.domain.com

My understanding is that mDNS resolution is a local-client process so whatever mechanism GoSungrow is using to resolve names appears to be bypassing that local resolution in favour of forwarding the query to the DNS server.

I have run the tests on both macOS and Raspberry Pi OS clients. The behaviour is the same (ie the problem follows GoSungrow, not the OS) so I do not believe this is an OS dependency.

side-effect: macOS delays when mDNS used

Although it is unlikely to be related to the problem at hand, one oddity exposed by the test script occurs on macOS clients when mosquitto_pub is used to send a test message. If the broker is referenced by its:

This odd behaviour is repeatable on macOS but is not apparent when the test script is run on a Raspberry Pi.

test script

#!/usr/bin/env bash

SCRIPT=$(basename "$0")

if [ $# -ne 1 ] ; then
   echo "Usage: $SCRIPT broker"
   exit 1
fi

BROKER="$1"
TOPIC="homeassistant/sensor/GoSungrow/config"

# report platform
uname -a

# echo commands
set -x

# verify reachability
ping -c 1 $BROKER

# tell GoSungrow how to reach broker
GoSungrow config write --mqtt-host=$BROKER >/dev/null

# confirm GoSungrow heard the configuration instruction
grep mqtt-host $HOME/.GoSungrow/config.json

# set up listener running in the background
mosquitto_sub -v -h $BROKER -t "$TOPIC" -F "***HEARD*** %I %t %p" &

# give listener time to settle
sleep 5

# publish message by hand
mosquitto_pub -h $BROKER -t "$TOPIC" -m "Test message generated at $(date)"

# let GoSungrow run for 5 seconds
timeout 5 GoSungrow mqtt run

# kill mosquitto_sub
kill %1

macOS as client

test 1: reach broker via IP address

[marble Wed Sep 06 23:28:57 ~] $ ./mqtt-test.sh 192.168.132.102
Darwin marble.my.domain.com 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
+ ping -c 1 192.168.132.102
PING 192.168.132.102 (192.168.132.102): 56 data bytes
64 bytes from 192.168.132.102: icmp_seq=0 ttl=64 time=0.498 ms

--- 192.168.132.102 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.498/0.498/0.498/0.000 ms
+ GoSungrow config write --mqtt-host=192.168.132.102
Using config file '/Users/pkmarble/.GoSungrow/config.json'
+ grep mqtt-host /Users/pkmarble/.GoSungrow/config.json
  "mqtt-host": "192.168.132.102",
+ sleep 5
+ mosquitto_sub -v -h 192.168.132.102 -t homeassistant/sensor/GoSungrow/config -F '***HEARD*** %I %t %p'
++ date
+ mosquitto_pub -h 192.168.132.102 -t homeassistant/sensor/GoSungrow/config -m 'Test message generated at Wed Sep  6 23:39:21 AEST 2023'
+ timeout 5 GoSungrow mqtt run
***HEARD*** 2023-09-06T23:39:21+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed Sep  6 23:39:21 AEST 2023
2023/09/06 23:39:21 INFO: Connecting to MQTT HASSIO Service...
2023/09/06 23:39:21 INFO: Connecting to SunGrow...
2023/09/06 23:39:21 INFO: Found SunGrow 3 devices
***HEARD*** 2023-09-06T23:39:21+1000 homeassistant/sensor/GoSungrow/config {"~":"homeassistant/sensor/GoSungrow","name":"GoSungrow","unique_id":"GoSungrow","state_topic":"~/state","device":{"identifiers":["GoSungrow"],"sw_version":"GoSungrow https://github.com/MickMake/GoSungrow","name":"GoSungrow Service","manufacturer":"MickMake","model":"SunGrow"}}
2023/09/06 23:39:21 INFO: Caching Sungrow metadata...
2023/09/06 23:39:21 INFO: Cached 797 Sungrow data points...
2023/09/06 23:39:22 INFO: Syncing 510 entries with HASSIO from queryDeviceList.
CU--CUCU-CU-CU-CUCU-CU---CU-CU-CUCUCUCUCU-CUCU--CU---CUCUCUCU
2023/09/06 23:39:22 INFO: Syncing 148 entries with HASSIO from getPsList.
CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCU??CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCU
2023/09/06 23:39:22 INFO: Syncing 205 entries with HASSIO from getPsDetail.
?CUCU?CUCU??CU??CUCUCUCUCUCUCUCUCUCU?CUCUCUCU?CUCUCU???CU?CUCUCU?CUCUCUCUCUCUCUCUCUCUCU?CU?CU?CU?CUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCU?CUCU?CUCUCUCU?CUCUCUCUCUCU?CU?CU??CUCU?CUCU?CU?CU?CU?CU?CUCUCU?CUCUCUCUCU?CUCUCUCUCU?CUCU?CUCUCUCU?CUCUCU?CUCUCUCU?CUCUCUCUCUCU??CUCUCUCUCUCUCUCUCU?CUCUCUCU?CUCU??????CU?CUCUCUCUCUCUCU?CUCUCUCU?CUCUCUCU?CUCU?CUCUCUCU?
2023/09/06 23:39:22 INFO: Starting ticker...
2023/09/06 23:39:22 INFO: Fetch Schedule: 5m
2023/09/06 23:39:22 INFO: Sleep Delay:    40s
+ kill %1

test 2: reach broker via fully-qualified domain name

[marble Wed Sep 06 23:39:26 ~] $ ./mqtt-test.sh sec-dev.my.domain.com
Darwin marble.my.domain.com 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
+ ping -c 1 sec-dev.my.domain.com
PING sec-dev.my.domain.com (192.168.132.102): 56 data bytes
64 bytes from 192.168.132.102: icmp_seq=0 ttl=64 time=0.256 ms

--- sec-dev.my.domain.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.256/0.256/0.256/0.000 ms
+ GoSungrow config write --mqtt-host=sec-dev.my.domain.com
Using config file '/Users/pkmarble/.GoSungrow/config.json'
+ grep mqtt-host /Users/pkmarble/.GoSungrow/config.json
  "mqtt-host": "sec-dev.my.domain.com",
+ sleep 5
+ mosquitto_sub -v -h sec-dev.my.domain.com -t homeassistant/sensor/GoSungrow/config -F '***HEARD*** %I %t %p'
++ date
+ mosquitto_pub -h sec-dev.my.domain.com -t homeassistant/sensor/GoSungrow/config -m 'Test message generated at Wed Sep  6 23:39:42 AEST 2023'
+ timeout 5 GoSungrow mqtt run
***HEARD*** 2023-09-06T23:39:42+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed Sep  6 23:39:42 AEST 2023
2023/09/06 23:39:42 INFO: Connecting to MQTT HASSIO Service...
2023/09/06 23:39:42 INFO: Connecting to SunGrow...
2023/09/06 23:39:42 INFO: Found SunGrow 3 devices
***HEARD*** 2023-09-06T23:39:42+1000 homeassistant/sensor/GoSungrow/config {"~":"homeassistant/sensor/GoSungrow","name":"GoSungrow","unique_id":"GoSungrow","state_topic":"~/state","device":{"identifiers":["GoSungrow"],"sw_version":"GoSungrow https://github.com/MickMake/GoSungrow","name":"GoSungrow Service","manufacturer":"MickMake","model":"SunGrow"}}
2023/09/06 23:39:42 INFO: Caching Sungrow metadata...
2023/09/06 23:39:42 INFO: Cached 797 Sungrow data points...
2023/09/06 23:39:42 INFO: Syncing 148 entries with HASSIO from getPsList.
CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCU?CUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU
2023/09/06 23:39:42 INFO: Syncing 205 entries with HASSIO from getPsDetail.
CUCU????CUCUCUCU?CUCUCU?CUCU??CUCU?CU?CUCU??CUCU?CUCUCUCU?CUCU?CUCUCUCU?CUCUCUCUCUCUCU?CU??CU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCU?CU?CUCUCU?CU?CUCUCUCUCU?CUCUCUCUCUCU??CUCU?CUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCU??CUCU??CUCUCUCUCUCU???CUCUCUCU?CUCUCUCUCU???CUCUCU????CUCUCUCUCUCUCUCU??CU??CUCUCUCUCU?CUCUCU?CU?CUCUCUCU?CU?CUCU?CUCU
2023/09/06 23:39:42 INFO: Syncing 510 entries with HASSIO from queryDeviceList.
-CUCUCU---CUCUCUCU-CUCUCUCUCU-CUCUCUCUCU---CU-CUCU---CU-CU---
2023/09/06 23:39:42 INFO: Starting ticker...
2023/09/06 23:39:42 INFO: Fetch Schedule: 5m
2023/09/06 23:39:42 INFO: Sleep Delay:    40s
+ kill %1

test 3: reach broker via multicast DNS name

[marble Wed Sep 06 23:39:47 ~] $ ./mqtt-test.sh sec-dev.local
Darwin marble.my.domain.com 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
+ ping -c 1 sec-dev.local
PING sec-dev.local (192.168.132.102): 56 data bytes
64 bytes from 192.168.132.102: icmp_seq=0 ttl=64 time=0.221 ms

--- sec-dev.local ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.221/0.221/0.221/0.000 ms
+ GoSungrow config write --mqtt-host=sec-dev.local
Using config file '/Users/pkmarble/.GoSungrow/config.json'
+ grep mqtt-host /Users/pkmarble/.GoSungrow/config.json
  "mqtt-host": "sec-dev.local",
+ sleep 5
+ mosquitto_sub -v -h sec-dev.local -t homeassistant/sensor/GoSungrow/config -F '***HEARD*** %I %t %p'
++ date
+ mosquitto_pub -h sec-dev.local -t homeassistant/sensor/GoSungrow/config -m 'Test message generated at Wed Sep  6 23:40:03 AEST 2023'
+ timeout 5 GoSungrow mqtt run
***HEARD*** 2023-09-06T23:40:08+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed Sep  6 23:40:03 AEST 2023
2023/09/06 23:40:08 INFO: Connecting to MQTT HASSIO Service...
2023/09/06 23:40:08 INFO: Connecting to SunGrow...
2023/09/06 23:40:08 INFO: Found SunGrow 3 devices
Error: network Error : dial tcp: lookup sec-dev.local on 192.168.132.55:53: no such host
Usage:
  GoSungrow mqtt run [flags]

Aliases:
  run, 

Examples:
    GoSungrow mqtt run  

Flags: Use "GoSungrow help flags" for more info.

Additional help topics:

ERROR: network Error : dial tcp: lookup sec-dev.local on 192.168.132.55:53: no such host
+ kill %1

Unexplained round-trip delay

In the above:

***HEARD*** 2023-09-06T23:40:08+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed Sep  6 23:40:03 AEST 2023

shows a significant difference between the time embedded in the payload and the time logged when the message was heard. By way of comparison, the line below is from test 3 run on a Raspberry Pi and shows no material delay:

***HEARD*** 2023-09-06T23:41:10+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed 06 Sep 2023 11:41:10 PM AEST

This discrepancy is repeatable. It occurs on both Intel and Apple silicon (macOS Ventura).

Raspberry Pi OS as client

test 1: reach broker via IP address

pi@sys-bak:~$ ./mqtt-test.sh 192.168.132.102
Linux sys-bak 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
+ ping -c 1 192.168.132.102
PING 192.168.132.102 (192.168.132.102) 56(84) bytes of data.
64 bytes from 192.168.132.102: icmp_seq=1 ttl=64 time=0.239 ms

--- 192.168.132.102 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.239/0.239/0.239/0.000 ms
+ GoSungrow config write --mqtt-host=192.168.132.102
Using config file '/home/pi/.GoSungrow/config.json'
+ grep mqtt-host /home/pi/.GoSungrow/config.json
  "mqtt-host": "192.168.132.102",
+ sleep 5
+ mosquitto_sub -v -h 192.168.132.102 -t homeassistant/sensor/GoSungrow/config -F '***HEARD*** %I %t %p'
++ date
+ mosquitto_pub -h 192.168.132.102 -t homeassistant/sensor/GoSungrow/config -m 'Test message generated at Wed 06 Sep 2023 11:40:36 PM AEST'
***HEARD*** 2023-09-06T23:40:36+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed 06 Sep 2023 11:40:36 PM AEST
+ timeout 5 GoSungrow mqtt run
Logging in again
2023/09/06 23:40:36 INFO: Connecting to MQTT HASSIO Service...
2023/09/06 23:40:36 INFO: Connecting to SunGrow...
2023/09/06 23:40:36 INFO: Found SunGrow 3 devices
***HEARD*** 2023-09-06T23:40:36+1000 homeassistant/sensor/GoSungrow/config {"~":"homeassistant/sensor/GoSungrow","name":"GoSungrow","unique_id":"GoSungrow","state_topic":"~/state","device":{"identifiers":["GoSungrow"],"sw_version":"GoSungrow https://github.com/MickMake/GoSungrow","name":"GoSungrow Service","manufacturer":"MickMake","model":"SunGrow"}}
2023/09/06 23:40:36 INFO: Caching Sungrow metadata...
2023/09/06 23:40:36 INFO: Cached 797 Sungrow data points...
2023/09/06 23:40:37 INFO: Syncing 148 entries with HASSIO from getPsList.
CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCU?CUCUCUCUCU?CUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCU
2023/09/06 23:40:37 INFO: Syncing 205 entries with HASSIO from getPsDetail.
CUCUCUCUCUCUCUCUCU?CU?CUCUCUCU??CUCUCUCU?CU?????CU?CUCU?CUCUCUCUCUCUCUCU??CUCUCUCU?CU???CUCUCU?CUCUCUCUCU?CU?CUCU??CU?CUCUCUCUCUCU?CU???CUCUCUCUCUCUCU?CUCU???CUCUCU?CU??CUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCU?CU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CU?CUCU?CUCUCUCUCUCUCU?CUCUCUCU?CUCUCU?CUCUCUCUCUCUCUCU?CUCUCU?CUCU?CU?CUCUCU????CU?CUCUCU?CUCUCUCUCUCUCU?CU
2023/09/06 23:40:37 INFO: Syncing 510 entries with HASSIO from queryDeviceList.
--CUCUCUCU-CU-CUCU-CUCUCUCU-CU--CU-CU--CU-CUCU-CU---CUCUCU-CU
2023/09/06 23:40:37 INFO: Starting ticker...
2023/09/06 23:40:37 INFO: Fetch Schedule: 5m
2023/09/06 23:40:37 INFO: Sleep Delay:    40s
+ kill %1

test 2: reach broker via fully-qualified domain name

pi@sys-bak:~$ ./mqtt-test.sh sec-dev.my.domain.com
Linux sys-bak 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
+ ping -c 1 sec-dev.my.domain.com
PING sec-dev.my.domain.com (192.168.132.102) 56(84) bytes of data.
64 bytes from sec-dev.my.domain.com (192.168.132.102): icmp_seq=1 ttl=64 time=0.282 ms

--- sec-dev.my.domain.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.282/0.282/0.282/0.000 ms
+ GoSungrow config write --mqtt-host=sec-dev.my.domain.com
Using config file '/home/pi/.GoSungrow/config.json'
+ grep mqtt-host /home/pi/.GoSungrow/config.json
  "mqtt-host": "sec-dev.my.domain.com",
+ sleep 5
+ mosquitto_sub -v -h sec-dev.my.domain.com -t homeassistant/sensor/GoSungrow/config -F '***HEARD*** %I %t %p'
***HEARD*** 2023-09-06T23:40:48+1000 homeassistant/sensor/GoSungrow/config {"~":"homeassistant/sensor/GoSungrow","name":"GoSungrow","unique_id":"GoSungrow","state_topic":"~/state","device":{"identifiers":["GoSungrow"],"sw_version":"GoSungrow https://github.com/MickMake/GoSungrow","name":"GoSungrow Service","manufacturer":"MickMake","model":"SunGrow"}}
++ date
+ mosquitto_pub -h sec-dev.my.domain.com -t homeassistant/sensor/GoSungrow/config -m 'Test message generated at Wed 06 Sep 2023 11:40:53 PM AEST'
***HEARD*** 2023-09-06T23:40:53+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed 06 Sep 2023 11:40:53 PM AEST
+ timeout 5 GoSungrow mqtt run
2023/09/06 23:40:53 INFO: Connecting to MQTT HASSIO Service...
2023/09/06 23:40:53 INFO: Connecting to SunGrow...
2023/09/06 23:40:53 INFO: Found SunGrow 3 devices
***HEARD*** 2023-09-06T23:40:53+1000 homeassistant/sensor/GoSungrow/config {"~":"homeassistant/sensor/GoSungrow","name":"GoSungrow","unique_id":"GoSungrow","state_topic":"~/state","device":{"identifiers":["GoSungrow"],"sw_version":"GoSungrow https://github.com/MickMake/GoSungrow","name":"GoSungrow Service","manufacturer":"MickMake","model":"SunGrow"}}
2023/09/06 23:40:53 INFO: Caching Sungrow metadata...
2023/09/06 23:40:53 INFO: Cached 797 Sungrow data points...
2023/09/06 23:40:53 INFO: Syncing 510 entries with HASSIO from queryDeviceList.
---CU-CUCUCUCUCU-CU-CU-CUCUCU--CUCU-CU-CUCU--CUCUCU-CU-CU-CU-
2023/09/06 23:40:53 INFO: Syncing 148 entries with HASSIO from getPsList.
CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CU?CUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU
2023/09/06 23:40:53 INFO: Syncing 205 entries with HASSIO from getPsDetail.
?CUCUCUCU??CUCUCUCU??CUCU?CUCUCUCUCUCUCU?CUCUCU?CUCU?CUCUCU?CU?CUCU?CUCUCUCUCUCUCUCUCU?CU?CU?CU?CU?CUCUCUCUCU?CUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCU?CUCUCUCUCUCU?CU?CUCUCU?CU?CUCUCU?CUCUCUCUCUCU?CUCUCUCUCU??CU?CU?CUCUCUCUCU?CU?CUCU?CU??CUCUCUCU????CUCUCUCUCUCUCUCU?CUCU?CUCUCUCUCU?CUCUCUCUCUCUCUCUCU?CU??CUCUCUCUCUCUCUCU?CU?CUCU?CUCU?CUCUCUCU???CU?CUCUCU?CUCU?
2023/09/06 23:40:53 INFO: Starting ticker...
2023/09/06 23:40:53 INFO: Fetch Schedule: 5m
2023/09/06 23:40:53 INFO: Sleep Delay:    40s
+ kill %1

test 3: reach broker via multicast DNS name

pi@sys-bak:~$ ./mqtt-test.sh sec-dev.local
Linux sys-bak 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
+ ping -c 1 sec-dev.local
PING sec-dev.local (192.168.132.103) 56(84) bytes of data.
64 bytes from sec-dev-air.my.domain.com (192.168.132.103): icmp_seq=1 ttl=64 time=28.1 ms

--- sec-dev.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 28.129/28.129/28.129/0.000 ms
+ GoSungrow config write --mqtt-host=sec-dev.local
Using config file '/home/pi/.GoSungrow/config.json'
+ grep mqtt-host /home/pi/.GoSungrow/config.json
  "mqtt-host": "sec-dev.local",
+ sleep 5
+ mosquitto_sub -v -h sec-dev.local -t homeassistant/sensor/GoSungrow/config -F '***HEARD*** %I %t %p'
***HEARD*** 2023-09-06T23:41:05+1000 homeassistant/sensor/GoSungrow/config {"~":"homeassistant/sensor/GoSungrow","name":"GoSungrow","unique_id":"GoSungrow","state_topic":"~/state","device":{"identifiers":["GoSungrow"],"sw_version":"GoSungrow https://github.com/MickMake/GoSungrow","name":"GoSungrow Service","manufacturer":"MickMake","model":"SunGrow"}}
++ date
+ mosquitto_pub -h sec-dev.local -t homeassistant/sensor/GoSungrow/config -m 'Test message generated at Wed 06 Sep 2023 11:41:10 PM AEST'
+ timeout 5 GoSungrow mqtt run
***HEARD*** 2023-09-06T23:41:10+1000 homeassistant/sensor/GoSungrow/config Test message generated at Wed 06 Sep 2023 11:41:10 PM AEST
2023/09/06 23:41:10 INFO: Connecting to MQTT HASSIO Service...
2023/09/06 23:41:10 INFO: Connecting to SunGrow...
2023/09/06 23:41:10 INFO: Found SunGrow 3 devices
Error: network Error : dial tcp: lookup sec-dev.local on 127.0.0.1:53: no such host
Usage:
  GoSungrow mqtt run [flags]

Aliases:
  run, 

Examples:
    GoSungrow mqtt run  

Flags: Use "GoSungrow help flags" for more info.

Additional help topics:

ERROR: network Error : dial tcp: lookup sec-dev.local on 127.0.0.1:53: no such host
+ kill %1