Home Assistant Add-On: AMR2MQTT

For some reason I can’t get this to work :thinking: each time I try to save the configuration I get this:

Failed to save add-on configuration, expected int. Got {‘meters’: [{‘id’: ‘*******’, ‘protocol’: ‘scm’, ‘name’: ‘Energy Meter’, ‘type’: ‘energy’, ‘multiplier’: 0.01, ‘unit_of_measurement’: ‘kWh’, ‘model’: ‘C1A3B’}], ‘log_level’: ‘debug’}

Ok, I was able to find the problem: the ID I had was a string, my bad, I was confused, upon leaving the meters empty and checking the logs I was able to find the proper ID, an integer of 8 digits, and changing it saved my configuration and now seems to be working just fine.

Setup was super easy and I was able to import my water meter consumption.
Anyone has been able to add the sensor to the new Water portion of the Energy consumption dashboard ?

can you share your setup for the water meter and what brand it is? Maybe it gives me some hints or ideas.

I left the meters defined as an empty array in order to capture everything but could not find my water member number not sure why :thinking:

It’s a Neptune meter. I just went to look at the value of m3 on the meter and waited until a device showed up in that range. That was the id of my meter that i added.
I’m using mosquitto mqtt and amr2mqtt with this config

meters:
  - id: xxxxxxxxxx
    protocol: scm
    name: Water meter
    type: water
    multiplier: 0.01
    unit_of_measurement: m³
mqtt: {}
home_assistant_discovery_enabled: true
last_seen: ISO_8601
1 Like

Well I added a template sensor and that seems to work and I can select the sensor in the energy dashboard. So this is a workaround but I would hope the plugin would be in a position to be configured to pass on the correct attributes to HA
@CentralCommand Am I missing something in the configuration or is this not a feature currently?

  - platform: template
    sensors:
      # convert value from add-in into statistic
      water_meter_total_m3:
        friendly_name: "Total Water Consumption"
        device_class: water
        unit_of_measurement: m³
        value_template: "{{ ((states('sensor.water_meter_consumption') | float))  }}"
        attribute_templates:
            state_class: total_increasing 
1 Like

what does this exactly means? Mine is also a Neptune ProCode R900i 5/8" T10 but I am not able to get it working. :frowning_face:

So I have a traditional mechanical meter for water. There’s a device wired to transmit the consumption value. If I look at the mechanical meter I see a consumption value in cubic metres (m3). I use that value to identify which meter is mine then use that to configure the add-on.
For the electrical meter, I’m waiting for snow to melt a bit to find the number of the meter since I realized that the RPI3b+ might not be able to support all the broadcasts and the add-on would crash on me. I was getting similar messages:

ll+, now 327
ll+, now 328
ll+, now 329
ll+, now 330
reference: addon-amr2mqtt/DOCS.md at bc8c6fb853680aea716c7e43b5b3c3794de389d7 · mdegat01/addon-amr2mqtt · GitHub

I was missing a number for the meter ID and also the protocol is different than yours, this is the correct version:

- id: <my_device_id>
  protocol: r900
  name: Water Meter
  type: water
  multiplier: 0.01
  unit_of_measurement: gal
  model: Neptune R900i

However, I am unable to add the sensor sensor.water_meter_consumption to my energy dashboard, and not sure why exactly since I am seeing it receiving data and showing up the total consumption :expressionless:

Docs here says:

If you manually integrate your sensors, for example, using the MQTT or RESTful integrations: Make sure you set and provide the device_class , state_class , and unit_of_measurement for those sensors.

Not sure if I need those somehow to make it to work

So you did the bit in the add-on, and at that point I also thought it would work and I hope the add-on will be modified appropriately, but in the meantime this post from above bridges the gap for me, to allow the data to be seen in the energy dashboard

1 Like

Out of curiosity, in what file do you add the template configuration? I am struggling to find the right one :expressionless:

in theory, it all goes into your configuration.yaml. If you did a separate sensors.yaml then it would go in there. This is where I put mine with all my other template sensors and it works

1 Like

New to this add-on and seems easy enough to follow; thanks for putting this together!

I’ve got the add-on installed and have the Nano2+ plugged in and MQTT configured.
Because I’m not entirely sure about my meter, I’ve just left the “meters” section blank to see what I can pickup.

Using MQTT Explorer, I can see that the system is up and running, although it’s not picking up any meters nearby it seems because it doesn’t ever show any messages other than what you see in the screenshot.

image

I checked my logs but there wasn’t any useful info; because the meters section is empty, it just looks exactly like what your docs say under troubleshooting:

ll+, now 327
ll+, now 328
ll+, now 329
ll+, now 330

Is it possible that there are actually no meters readable in the area (maybe they’re all encrypted)? or am I missing something?

I’ve got a Itron Metris M250 gas meter and a Sensus Flexnet 530x power meter, neither of which are listed as compatible, but from my quick searches, they do appear to be smart meters.

Any suggestions would be welcome :slight_smile:

Lastly, there is a RTLAMR message which shows up every so often, but all it says is “offline” all the time. I did tinker with RTLMAR2MQTT and so i’m wondering if it could just be a remnant of that; it’s not part of this AMR2MQTT add-on i’m assuming?

This addon is great, I was able to set it up and can read from my meter. My only problem is that my meter seems to read in 10’s of gallons, rather than single gallons. (at least according to water bill) The Energy dashboard shows me using 200 gallons last month, but my water bill shows 2000. How can adjust/change this?

There’s a multiplier property you can use on the meter configuration.

I’ve tried that, but it doesn’t seem to be working.

- id: xxxxxxxx
  protocol: scm+
  name: water_meter
  unit_of_measurement: gal
  icon: mdi:water
  device_class: water
  multiplier: 10
  state_class: total_increasing

Did HA 2023.4 break this integration for someone else? I am not receiving data since I upgraded :thinking:

This shows up in the logs:
> 19:53:21.353248 main.go:145: Error reading samples: EOF

but I am not sure what it means.

well restarting Mosquito Broker and AMR2MQTT make things get back in a working state, weird, lost three days of data because of this :expressionless: now I am thinking the problem was not HA but the recent Mosquito Broker update

So I got this hooked up to my water and gas meter pretty easily.

However utilizing them on the energy dashboard was a little bit of fun. But basically

  • both AMR2MQTT sensors and Home Assistant Meter Helpers didn’t set the right device classes
    • the water meter (Neptune R900) didn’t have its device_class set at all from AMR2MQTT
    • the gas meter was set to type ‘gas’ by AMRMQTT
  • The energy dashboard looks for ‘gal’ and ‘CCF’, both of which could be set by AMR2MQTT for the mqtt sensors, but the home assistant meter sensor was setting ‘ccf’ which isn’t valid, it must be CCF

configuration.yaml - ‘meter consumption’ are from AMR2MQTT, ‘meter’ are home assistant meter helpers

homeassistant:
  customize:
    sensor.water_meter_consumption:
      device_class: water
    sensor.water_meter:
      device_class: water
    sensor.gas_meter_consumption:
      device_class: gas
    sensor.gas_meter:
      device_class: gas
      unit_of_measurement: CCF

AMR2MQTTT Config

- id: xxxxxxxxxxx
  protocol: r900
  name: Water Meter
  type: water
  unit_of_measurement: gal
  multiplier: 0.01
  precision: 2
  manufacturer: Neptune
  model: R900
- id: xxxxxxxxx
  protocol: scm+
  name: Gas Meter
  type: gas
  unit_of_measurement: CCF
  multiplier: 0.01
  precision: 2
  manufacturer: Itron
  model: Gen 5 500G
1 Like

I get this error…

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
usb_claim_interface error -6
Failed to open rtlsdr device #0.
[17:53:24] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
[17:53:24] INFO: Service restart after closing
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

I’m using the sdr dongle for rtl_433 stuff to, do I need 2 radios? Or can I use the same one for both services?

Hi all, new to HA in general so sorry in advance about dumb mistakes.
I’m troubleshooting the AMR2MQTT/MQTT connection and coming up empty. Everything is up to date, sysinfo below:

Add-on version: 2.1.2
You are running the latest version of this add-on.
System: Home Assistant OS 10.3  (aarch64 / raspberrypi4-64)
Home Assistant Core: 2023.7.0
Home Assistant Supervisor: 2023.07.1

I’ve verified that my RTL-SDR works and that my meters are readable on my PC using RTLAMR. And I can see messages published by my MQTT broker from my pc using MQTT explorer.

My mosquitto config:

logins:
  - username: mqtt-user
    password: #######
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
  active: false
  folder: mosquitto
  debug: true
debug: true

Ports are standard 1883 etc.

My AMR2MQTT config:

meters:
  - id: 17737313
    protocol: scm
    name: Electrical Meter
    type: energy
    manufacturer: Itron
  - id: 1567099574
    protocol: r900
    name: Water Meter
    type: water
    manufacturer: Neptune
mqtt:
  host: 127.0.0.1
  port: 1883
log_level: debug

The important part of the log seems to be:

INFO:root:Connecting to MQTT broker at 127.0.0.1:1883
Traceback (most recent call last):
  File "/amr2mqtt/amr2mqtt.py", line 515, in <module>
    mqttc = create_mqtt_client()
  File "/amr2mqtt/amr2mqtt.py", line 182, in create_mqtt_client
    client.connect(
  File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 941, in connect
    return self.reconnect()
  File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1075, in reconnect
    sock = self._create_socket_connection()
  File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 3546, in _create_socket_connection
    return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
  File "/usr/lib/python3.9/socket.py", line 843, in create_connection
    raise err
  File "/usr/lib/python3.9/socket.py", line 831, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
[10:18:51] WARNING: Halt add-on with exit code 1

Various levels of logging all indicate that the connection to the broker is refused, I’ve tried the shotgun approach of changing the address to everything I can think of; core-mosquitto, core-mosquitto.local, homeassistant.local, the IP of my RP4…

I have no idea. If anyone can help that would be really appreciated. Thanks