AMR2MQTT Issue Publishing Topics?

Hello,

I am trying to get AMR2MQTT to work. I have configured AMR2MQTT and Mosquitto Broker. I initially had trouble with AMR2MQTT giving a “connection refused” error. But I believe I resolved that successfully by correcting the port number. AMR2MQTT now connects to 10.1.1.114:1884 (which is local host, i had some issues getting 127.0.0.1 to work).

AMR2MQTT appears to be seeing my meters based on the log below:

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
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: AMR2MQTT
 AMR2MQTT for Home Assistant
-----------------------------------------------------------
 Add-on version: 2.1.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.1  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.5.3
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to DEBUG
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/02-set-timezone.sh
[20:37:31] INFO: Configuring timezone
cont-init: info: /etc/cont-init.d/02-set-timezone.sh exited 0
cont-init: info: running /etc/cont-init.d/30-config.sh
[20:37:31] DEBUG: Validate config and look for suggestions
[20:37:33] INFO: Ensure MQTT broker is reachable at 10.1.1.114:1884 (60s timeout)
cont-init: info: /etc/cont-init.d/30-config.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amr2mqtt (no readiness notification)
services-up: info: copying legacy longrun rtl_tcp (no readiness notification)
s6-rc: info: service legacy-services successfully started
[20:37:33] DEBUG: Setting MQTT details...
[20:37:33] INFO: Starting rtl_tcp daemon...
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Tuned to 100000000 Hz.
[20:37:35] INFO: Log level set to DEBUG
[20:37:35] INFO: Waiting for rtl_tcp...
Allocating 15 zero-copy buffers
[20:37:35] INFO: Handing over control to AMR2MQTT...
Signal caught, exiting!
Signal caught, exiting!
INFO:root:Starting rtlamr
INFO:root:Connecting to MQTT broker at 10.1.1.114:1884
Allocating 15 zero-copy buffers
20:37:36.686151 decode.go:45: CenterFreq: 912600155
20:37:36.687103 decode.go:46: SampleRate: 2359296
20:37:36.687318 decode.go:47: DataRate: 32768
20:37:36.687495 decode.go:48: ChipLength: 72
20:37:36.687690 decode.go:49: PreambleSymbols: 32
20:37:36.687874 decode.go:50: PreambleLength: 4608
20:37:36.688071 decode.go:51: PacketSymbols: 128
20:37:36.688249 decode.go:52: PacketLength: 18432
20:37:36.688451 decode.go:59: Protocols: r900,scm+
20:37:36.688572 decode.go:60: Preambles: 00000000000000001110010101100100,0001011010100011
20:37:36.688832 main.go:111: GainCount: 29
DEBUG:root:Meter: 91211181, MsgType: scm+, Reading: {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 91211181, "Consumption": 4408320.0, "Tamper": 5648, "PacketCRC": 21102}
DEBUG:root:Meter: 1568947908, MsgType: r900, Reading: {"ID": 1568947908, "Unkn1": 163, "NoUse": 36, "BackFlow": 0, "Consumption": 255575.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 1568515126, MsgType: r900, Reading: {"ID": 1568515126, "Unkn1": 163, "NoUse": 32, "BackFlow": 0, "Consumption": 192065.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 91211181, MsgType: scm+, Reading: {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 91211181, "Consumption": 4408320.0, "Tamper": 5648, "PacketCRC": 21102}
DEBUG:root:Meter: 1568947908, MsgType: r900, Reading: {"ID": 1568947908, "Unkn1": 163, "NoUse": 36, "BackFlow": 0, "Consumption": 255575.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 1568515126, MsgType: r900, Reading: {"ID": 1568515126, "Unkn1": 163, "NoUse": 32, "BackFlow": 0, "Consumption": 192065.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 91211181, MsgType: scm+, Reading: {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 91211181, "Consumption": 4408320.0, "Tamper": 5648, "PacketCRC": 21102}
DEBUG:root:Meter: 1568947908, MsgType: r900, Reading: {"ID": 1568947908, "Unkn1": 163, "NoUse": 36, "BackFlow": 0, "Consumption": 255575.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 1568515126, MsgType: r900, Reading: {"ID": 1568515126, "Unkn1": 163, "NoUse": 32, "BackFlow": 0, "Consumption": 192065.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 91211181, MsgType: scm+, Reading: {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 91211181, "Consumption": 4408320.0, "Tamper": 5648, "PacketCRC": 21102}
DEBUG:root:Meter: 91211181, MsgType: scm+, Reading: {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 91211181, "Consumption": 4408320.0, "Tamper": 5648, "PacketCRC": 21102}
DEBUG:root:Meter: 1568947908, MsgType: r900, Reading: {"ID": 1568947908, "Unkn1": 163, "NoUse": 36, "BackFlow": 0, "Consumption": 255575.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 1568515126, MsgType: r900, Reading: {"ID": 1568515126, "Unkn1": 163, "NoUse": 32, "BackFlow": 0, "Consumption": 192065.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}
DEBUG:root:Meter: 91211181, MsgType: scm+, Reading: {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 91211181, "Consumption": 4408320.0, "Tamper": 5648, "PacketCRC": 21102}
DEBUG:root:Meter: 1568515126, MsgType: r900, Reading: {"ID": 1568515126, "Unkn1": 163, "NoUse": 32, "BackFlow": 0, "Consumption": 192065.0, "Unkn3": 0, "Leak": 0, "LeakNow": 0}

According to the documentation, by default the meter consumption is published to amr2mqtt/{meter_ID}. I have attempted to override this with mqtt_base topic, with it set to amr2mqtt. This did not produce any changes.

I installed MQTT explorer on my Win 10 computer to attempt to view the topics and their values. However, the only one that displays is $SYS. I do not see any for “amr2mqtt.”

image

AMR2MQTT also says that it can be set to auto-publish the meter. I have this turned on, but nothing has automatically been added.

Any help you can provide would be great!

Thanks,

Dallas

Well, somehow i got it working. I tried a different mqtt app which seemed to trash my whole home assistant install. Recovered from a backup.

1.) Removed and reinstalled mqtt and amr2mqtt.
2.) Created a new account called “mqtt,” configured mosquitto to use that login. (All accounts discussed I created as non-admin)
3.) Create a new account called “mqttuser”, configured amr2mqtt to use that login on port 1883
4.) Enabled home_assistant_discovery_enabled on amr2mqtt.
5.) Overrode home_assistant_discovery_prefix to “homeassistant” even though that is the default.
6.) Created a new account called “mqttuser2”, configured MQTT Explorer on my win 10 machine to use that login.
7.) Saw the topics being published both under /amr2mqtt and /homeassistant.
8.) Finished setup under INTEGRATIONS for Mosquitto. This allowed the sensors to start being usable as devices.

Interestingly, after trying just defaults and not creating a user, there were no errors this time from amr2mqtt but there were intermittently in the logs for mosquitto saying that an unauthenticated user was disconnected. So thats what prompted me to re-try the creation of the user accounts.

Everything works now. Hopefully this may help someone.