Closed deanfourie1 closed 7 months ago
Hello! I am working on a fix for this :)
Hello @deanfourie1, I have now made a new version. I have been testing this for a few days, and it seems to work well. The addon should now detect if HA reboots and republish the device.
Please test version 2024.4.0 and see if that works better for you. :)
Great, thank you. I will test it!
How did it work?
I am working on a new release over the next few days to optimize the addon further.
Please close the issue if this issue is resolved or we can further investigate if needed.
No sorry,
It is still not working, again on boot it is not starting.
Is is however saying that it is publishing to MQTT but nothing shows
Hello again. Sorry to hear that!
What version of the addon are you running, and what version of HA and MQTT are you using?
The addon should detect HA reboot IF you use the integrated MQTT (Mosquitto) that is recommended.
The way to check this is to ssh into the HA instance (use Advanced SSH & Web Terminal), disable privileged mode and run the logs output from the addon. You should see "detected" message for reboot. Do it in this order:
2024-04-15 11:54:34,965 - MQTT Publisher - INFO - Published 6 updates in the last 2.0 minutes
2024-04-15 11:56:35,625 - MQTT Publisher - INFO - Published 5 updates in the last 2.0 minutes
2024-04-15 11:58:35,717 - MQTT Publisher - INFO - Published 6 updates in the last 2.0 minutes
2024-04-15 12:00:07,850 - MQTT Publisher - INFO - Home Assistant reboot detected. Re-sent MQTT discovery message.
2024-04-15 12:00:36,567 - MQTT Publisher - INFO - Published 6 updates in the last 2.0 minutes
2024-04-15 12:02:36,932 - MQTT Publisher - INFO - Published 6 updates in the last 2.0 minutes
2024-04-15 12:04:37,662 - MQTT Publisher - INFO - Published 6 updates in the last 2.0 minutes
Make sure you are on 2024.1.0 or later for this to work. If that does not work, then please enable debug, and repeat the procedure and share the logs so I could take a look.
Thank you!
I do believe that it is still the GPSD daemon, either not bring up the UART.
I seem to have to forcibly start GPSD on the correct UART, same as last time.
Ok, the add-on should not restart if you only restart home assistant. What plattform do you run Home Assistant on? And how do you connect the GPS device?
I am running on a RPI4.
Generally I only reboot HA, but sometimes reboot the system via SSH with sudo reboot
And when you do it does not recognize the GPS device? What is the device list shown in the config of the addon?
dean@boat-pi:/dev $ systemctl status gpsd
○ gpsd.service - GPS (Global Positioning System) Daemon
Loaded: loaded (/lib/systemd/system/gpsd.service; disabled; preset: enable>
Active: inactive (dead)
TriggeredBy: ○ gpsd.socket
dean@boat-pi:/dev $ cat /dev/ttyS0
cat: /dev/ttyS0: Device or resource busy
Oh .... you are not running Home Assistant Supervisor? You are running Raspbian operating system or something like that?
noo i am running supervised
Just to confirm.
dean@boat-pi:/dev $ sudo docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
552ce7fd3955 1f3d020e/armv7-addon-hassosi2cconfiguratoraddon:0.14 "/init /run.sh" 12 minutes ago Up 12 minutes addon_1f3d020e_hassosi2cconfiguratoraddon
282317255c0c sbarmen/armv7-addon-gpsd2mqtt:2024.4.1 "/init /run.sh" 7 hours ago Up 7 hours addon_2d5c2698_gpsd2mqtt
8faa9931bd68 ghcr.io/brenner-tobias/cloudflared/armv7:5.1.8 "/init" 7 hours ago Up 7 hours addon_9074a9fa_cloudflared
2738cd97d87e homeassistant/armv7-addon-configurator:5.8.0 "/init" 7 hours ago Up 7 hours (healthy) addon_core_configurator
a6ce49b40238 ghcr.io/esphome/esphome-hassio:2024.3.2 "/init" 7 hours ago Up 7 hours addon_5c53de3b_esphome
81d8d0d39c17 homeassistant/armv7-addon-mosquitto:6.4.0 "/init" 7 hours ago Up 7 hours 0.0.0.0:1883-1884->1883-1884/tcp, :::1883-1884->1883-1884/tcp, 0.0.0.0:8883-8884->8883-8884/tcp, :::8883-8884->8883-8884/tcp addon_core_mosquitto
7fe6a658928d ghcr.io/home-assistant/aarch64-hassio-multicast:2024.03.0 "/init" 7 hours ago Up 7 hours hassio_multicast
6de102138771 ghcr.io/home-assistant/aarch64-hassio-audio:2023.12.0 "/init" 7 hours ago Up 7 hours hassio_audio
b91dedb33f64 ghcr.io/home-assistant/aarch64-hassio-dns:2024.04.0 "/init" 7 hours ago Up 7 hours hassio_dns
1f7abd072519 ghcr.io/home-assistant/aarch64-hassio-cli:2024.04.0 "/init" 7 hours ago Up 7 hours hassio_cli
228dbdeeb72b ghcr.io/home-assistant/raspberrypi4-homeassistant:2024.4.3 "/init" 9 hours ago Up 12 minutes homeassistant
374fe7902cae ghcr.io/home-assistant/aarch64-hassio-supervisor:latest "/init" 4 days ago Up 7 hours hassio_supervisor
3a1483fd42f9 nicolargo/glances "/bin/sh -c '/venv/b…" 6 weeks ago Up 7 hours 0.0.0.0:61208-61209->61208-61209/tcp, :::61208-61209->61208-61209/tcp festive_beaver
d0ca2c99139e ghcr.io/blakeblackshear/frigate:stable "/init" 6 weeks ago Up 7 hours (healthy) 1935/tcp, 0.0.0.0:8554-8555->8554-8555/tcp, :::8554-8555->8554-8555/tcp, 0.0.0.0:8555->8555/udp, :::8555->8555/udp, 0.0.0.0:80->5000/tcp, :::80->5000/tcp frigate
4d301003c68b 4a224a662ed2 "/init" 7 weeks ago Exited (255) 7 weeks ago addon_core_ssh
9df6916dc757 ghcr.io/home-assistant/aarch64-hassio-observer:2023.06.0 "/usr/bin/observer" 3 months ago Up 7 hours 0.0.0.0:4357->80/tcp, :::4357->80/tcp hassio_observer
dean@boat-pi:/dev $
Does GPSD need to be running locally on the PI? Or does GPSD run within your addon or container? Just because that would explain the the GPSD daemon is not running with the systemctl status above.
It would also show why the /dev/ssyS0 resource is busy.
After stopping your addon, I can read the output of /dev/ttyS0 but there is no data.
dean@boat-pi:/dev $ cat /dev/ttyS0
dean@boat-pi:/dev $
GPSD is running inside the add-on (which is a container) and should not be running on the host OS. I think you should disable the systemd service.
systemctl disable gpsd
Great ok, let me do that. I could even uninstall it right?
Absolutely. But disabling should be enough for now.
Ok, I disabled your add on, and full machine reboot.
I will do the same and disable GPSD
dean@boat-pi:~ $ cat /dev/ttyS0
351,21,07,11,021,*79
$GPGSV,4,2,13,13,19,288,27,14,66,114,19,15,04,258,30,17,74,214,31*75
$GPGSV,4,3,13,19,59,276,31,21,14,140,26,22,68,187,37,24,11,220,30*7F
$GPGSV,4,4,13,30,41,006,29*40
$GLGSV,2,1,08,69,00,233,,76,09,050,,77,53,066,17,78,55,201,26*66
$GLGSV,2,2,08,79,07,220,,81,18,329,33,87,45,149,22,88,74,331,33*6C
$GNGLL,3638.24896,S,17443.39130,E,104424.00,A,A*6F
$GNTXT,01,01,01,More than 100 frame errors, UART RX was disabled*70
$GNTXT,01,01,01,NMEA unknown msg*46
$GNTXT,01,01,01,NMEA unknown msg*46
$GNTXT,01,01,01,NMEA unknown msg*46
$GNTXT,01,01,01,NMEA unknown msg*46
$GNTXT,01,01,01,NMEA unknown msg*46
$GNTXT,01,01,01,NMEA unknown msg*46
$GNTXT,01,01,01,NMEA unknown msg*46
$GNRMC,104425.00,A,3638.24900,S,17443.39134,E,0.054,,150424,,,A*7A
$GNVTG,,T,,M,0.054,N,0.101,K,A*3C
$GNGGA,104425.00,3638.24900,S,17443.39134,E,1,12,0.78,9.9,M,28.7,M,,*50
$GNGSA,A,3,24,02,19,30,14,21,22,17,06,13,,,1.19,0.78,0.91*19
$GNGSA,A,3,87,81,78,88,,,,,,,,,1.19,0.78,0.91*1B
$GPGSV,4,1,13,02,26,135,23,03,09,085,,06,26,351,21,07,11,021,*7B
$GPGSV,4,2,13,13,19,288,27,14,66,114,20,15,04,258,30,17,74,214,31*7F
$GPGSV,4,3,13,19,59,276,30,21,14,140,26,22,68,187,37,24,11,220,31*7F
$GPGSV,4,4,13,30,41,006,29*40
$GLGSV,2,1,08,69,00,233,,76,09,050,,77,53,066,16,78,55,201,26*67
Ok, this is the log output , yet still.
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Setting up serial device with the following: /dev/ttyS0 9600 cs8 clocal -cstopb
Starting GPSD with device "/dev/ttyS0"...
/usr/sbin/gpsd: 3.25 (revision 3.25)
Starting MQTT Publisher with username dean ...
2024-04-15 22:46:48,161 - MQTT Publisher - INFO - Connecting to MQTT broker
2024-04-15 22:46:49,164 - MQTT Publisher - INFO - Connected to MQTT broker
2024-04-15 22:46:49,165 - MQTT Publisher - INFO - Subscribe to MQTT topic homeassistant/status to listen for HA reboots.
2024-04-15 22:46:49,187 - MQTT Publisher - INFO - Verifying MQTT Connection ....
2024-04-15 22:46:49,188 - MQTT Publisher - INFO - Published MQTT discovery message to topic: homeassistant/device_tracker/gpsd2mqtt/fcbdedf5/config
2024-04-15 22:46:49,189 - MQTT Publisher - INFO - Starting location detection and sending GPS updates.
2024-04-15 22:48:48,240 - MQTT Publisher - INFO - Published 11 updates in the last 2.0 minutes
Check the integrations dashboard, under MQTT devices:
https://HA_URL/config/devices/dashboard?historyBack=1&domain=mqtt
Ok I think I found the issue,
For some reason, its created a second entity.
Not sure when or why this happened.
Yes I was afraid of that. What I suggest is the following. Just delete the addon, and go to entities and delete all the old entities.
I think this could have happened when I changed to ID for the MQTT entity. If you clean up and get rid of all the old ones it should normalize, and I do not suspect this will happen again.
Further to this, you should not need to set username/password for MQTT anymore. It should be able to discover authentication itself.
Ok lets give this a shot.
Hmm interesting, I uninstalled the addon and rebooted, but I still have data displayed.
Long, Lat and speed.
That is probably because of the config in configuration.yaml. That does not matter, and should not affect anything. Just delete the device_trackers (both the original one and the _2 if it exists). After that reinstall and configure.
Ok have done, reinstalled and rebooted, all looks good.
Sounds great :) That should be a permanent fix.
Thanks for the help! That's great!
No worries. Closing this one.
After a reboot of HA, the addon fails to start.
the log shows that it is publishing to the MQTT server,
however no data is being captured.
Thanks