Git Product home page Git Product logo

addon-amr2mqtt's People

Contributors

dependabot[bot] avatar mdegat01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

addon-amr2mqtt's Issues

add sensors for other meter fields

rtlamr reports several useful fields for the r900, like "leakNow" when there's an active leak detected by a water meter. having this be something like a binary sensor would be really useful because then I could make a HA alert trigger on it, for example.

I'm not sure if other meters / protocols have similarly useful fields besides the consumption value, but it might be useful to also report those too as new sensors?

Allow setting device # when using multiple radios

Is your feature request related to a problem? Please describe.
I run rtl_433 using 2 radios and would like to run this add-on on a 3rd radio, but getting conflicts.

Describe the solution you'd like
rtl_433 allows setting the device number to avoid conflicts, but this add-on defaults to device 0. Please add a setting so I can coordinate all of my addons/devices. It looks like rtlamr has this option when starting it: bemasher/rtlamr#230

Describe alternatives you've considered
I've tried setting devices on rtl_433 to 1 and 2 so that this addon can use default device 0, but still having issues and this addons exits

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.5  (amd64 / generic-x86-64)
 Home Assistant Core: 2023.8.4
 Home Assistant Supervisor: 2023.08.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
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
[11:11:52] 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
[11:11:53] INFO: Ensure MQTT broker is reachable at core-mosquitto:1883 (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)
[11:11:53] INFO: Starting rtl_tcp daemon...
s6-rc: info: service legacy-services successfully started
Found 3 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
  1:  Realtek, RTL2838UHIDIR, SN: 00000001
  2:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
usb_claim_interface error -6
Failed to open rtlsdr device #0.
[11:11:53] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
[11:11:53] 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

Additional context
bemasher/rtlamr#230

MQTT server is not reachable

Describe the bug
AMR2MQTT add-on refuses to connect to the Mosquitto MQTT server.

To Reproduce
Steps to reproduce the behavior:

For this to be reproducible you will need to be on the latest version of HomeAssistant, HomeAssistant OS and Supervisor (described in the latest section)

  1. Go to Settings > Add-ons > AMR2MQTT
  2. Click on 'Start'
  3. Open the Logs tab and click on the Refresh button so you get always the latest
  4. See the error in the logs section below

Expected behavior
AMR2MQTT successfully connects to Mosquitto MQTT broker.

Logs

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.3  (amd64 / qemux86-64)
 Home Assistant Core: 2023.7.3
 Home Assistant Supervisor: 2023.07.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
[08:13:59] 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
[08:13:59] DEBUG: Validate config and look for suggestions
[08:14:00] INFO: Ensure MQTT broker is reachable at core-mosquitto:1883 (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
[08:14:00] DEBUG: Setting MQTT details...
[08:14:00] INFO: Starting rtl_tcp daemon...
No supported devices found.
[08:14:00] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
[08:14:00] 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

Environment (please complete the following information):

  • Add-on version: 2.1.2
  • Home Assistant version: 2023.7.3
  • Supervisor version: 2023.07.1
  • Operating System: Home Assistant 10.3

Additional context

What I have tried (several times)?

  • While I know restarting HomeAssistant will not restart the Docker containers for this add-on I have restarted it several times just in case
  • Restart both: the Mosquitto MQTT add-on and this AMR2MQTT add-on

I have the Ring-MQTT with Video Streaming add-on installed and is talking nicely with Mosquitto MQTT broker so the problem does not seem to be that add-on.

UPD: today I updated to the latest 2023.8.0 version and the following message popped up which might be part of the issue:

Discovered entities with a name that starts with the device name
This stops working in version 2024.2.0. Please address before upgrading.
Some MQTT entities have an entity name that starts with the device name. This is not expected. To avoid a duplicate name the device name prefix is stripped of the entity name as a work-a-round. Please inform the maintainer of the software application that supplies the affected entities to fix this issue.

List of affected entities:

sensor.energy_meter_consumption
sensor.water_meter_consumption
sensor.energy_meter_last_interval_consumption
Warning - 8/2/2023

PermissionError when trying to start addon

Restored home assistant from full backup (moved from Raspberry Pi 3 to Raspberry Pi 4). AMR2MQTT fails with the error below. I have tried restarting home assistant multiple times and the addon multiple times.

Traceback (most recent call last):
  File "/amr2mqtt/amr2mqtt.py", line 18, in <module>
    import settings
  File "/amr2mqtt/settings.py", line 19, in <module>
    with open("/data/options.json", encoding="utf-8") as config_options:
PermissionError: [Errno 13] Permission denied: '/data/options.json'

Full log:

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 11.4  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2024.1.6
 Home Assistant Supervisor: 2023.12.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
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
[17:29:56] 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
[17:29:58] INFO: Ensure MQTT broker is reachable at core-mosquitto:1883 (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
[17:29:58] 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.
[17:30:00] INFO: Log level set to INFO
[17:30:00] INFO: Waiting for rtl_tcp...
Allocating 15 zero-copy buffers
[17:30:00] INFO: Handing over control to AMR2MQTT...
Signal caught, exiting!
Signal caught, exiting!
Traceback (most recent call last):
  File "/amr2mqtt/amr2mqtt.py", line 18, in <module>
    import settings
  File "/amr2mqtt/settings.py", line 19, in <module>
    with open("/data/options.json", encoding="utf-8") as config_options:
PermissionError: [Errno 13] Permission denied: '/data/options.json'
[17:30:01] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
[17:30:01] INFO: Service restart after closing
[17:30:01] 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
Signal caught, exiting!

Add-on version: 2.1.2
System: Home Assistant OS 11.4 (aarch64 / raspberrypi4-64)
Home Assistant Core: 2024.1.6
Home Assistant Supervisor: 2023.12.1

Appears to be the same issue as #104

Add config option force_update to allow derivative integration to work properly.

Background: I use HA's derivative integration to calculate flow rates from the meters. The problem is that the derivative flatlines instead of going to zero when the meter stops updating HA, due to zero consumption.

Suggestion: There is an mqtt option called force_update that will always update HA even when consumption has not changed, which in turn should correct the derivative behavior. Documentation here

It would be nice to expose this mqtt option as a config option for this addon.

Thanks!

MQTT discovery messages need to be updated for new Home Assistant

Describe the bug
Home Assistant now prints this warning in the UI:

This stops working in version 2024.2.0. Please address before upgrading.

Some MQTT entities have an entity name that starts with the device name. This is not expected. To avoid a duplicate name the device name prefix is stripped of the entity name as a work-a-round. Please inform the maintainer of the software application that supplies the affected entities to fix this issue.

List of affected entities:

  • sensor.gas_meter_consumption

To Reproduce

Look at logs in Home Assistant.

Expected behavior

This warning isn't present.

Logs

MQTT entity name starts with the device name in your config {'enabled_by_default': False, 'name': 'Gas Meter Protocol ID', 'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>, 'unique_id': 'amr2mqtt_xx_ProtocolID', 'value_template': Template<template=({{ value_json.ProtocolID }}) renders=0>, 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, 'availability': [{'topic': 'amr2mqtt/bridge/state', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'device': {'identifiers': ['amr2mqtt_xx'], 'name': 'Gas Meter', 'sw_version': '2.1.2', 'via_device': 'AMR2MQTT', 'connections': []}, 'state_topic': 'amr2mqtt/xx', 'qos': 0, 'payload_not_available': 'offline', 'availability_mode': 'latest', 'encoding': 'utf-8', 'payload_available': 'online', 'force_update': False}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Protocol ID'

Environment (please complete the following information):

  • Add-on version: 2.1.2
  • Home Assistant: 2023.8.0
  • Supervisor version: 2023.07.1
  • Operating system: Home Assistant OS 2023.8.0

Additional context

https://community.home-assistant.io/t/psa-mqtt-name-changes-in-2023-8/598099

I'm guessing the fix involves removing most of the {device_name} prefixes in amr2mqtt.py.

After HAOS 8.5 / Home Assistant Core 2022.8.7 update Addon fails

Describe the bug
After the update to HAOS 8.5 / HA Core 2022.8.7 on my generic_x86 based HAOS setup this addon stopped working.

The log file is filled with the same error:
17:43:49.026662 main.go:145: Error reading samples: EOF
17:43:49.026677 main.go:145: Error reading samples: EOF

To Reproduce
Steps to reproduce the behavior:

  1. Start Addon after above updates.

I have also uninstalled and reinstalled the Addon, and then completely restarting the host. Neither action helped the situation.

Expected behavior
Addon should feed MQTT messages to HA as before

Logs

After getting into debug mode so that I could see the logs from docker just as the Add-on starts, I get:

[17:46:41] 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.
[17:46:43] INFO: Log level set to INFO
[17:46:43] INFO: Waiting for rtl_tcp...
Allocating 15 zero-copy buffers
[17:46:43] INFO: Handing over control to AMR2MQTT...
INFO:root:Starting rtlamr
INFO:root:Connecting to MQTT broker at core-mosquitto:1883
Signal caught, exiting!
Signal caught, exiting!
Allocating 15 zero-copy buffers
17:46:48.403071 decode.go:45: CenterFreq: 912380000
17:46:48.403450 decode.go:46: SampleRate: 2359296
17:46:48.403468 decode.go:47: DataRate: 32768
17:46:48.403481 decode.go:48: ChipLength: 72
17:46:48.403495 decode.go:49: PreambleSymbols: 32
17:46:48.403509 decode.go:50: PreambleLength: 4608
17:46:48.403524 decode.go:51: PacketSymbols: 116
17:46:48.403540 decode.go:52: PacketLength: 16704
17:46:48.403562 decode.go:59: Protocols: r900
17:46:48.403577 decode.go:60: Preambles: 00000000000000001110010101100100
17:46:48.403664 main.go:111: GainCount: 29
Signal caught, exiting!
Signal caught, exiting!
17:46:53.712976 main.go:145: Error reading samples:  read tcp 127.0.0.1:60772->127.0.0.1:1234: read: connection reset by peer

Then it just continuously dumps the above message after that. 

Environment (please complete the following information):

  • Add-on version: 2.0
  • Supervisor version: 2022.08.3
  • Operating system: Home Assistant OS 8.5

Additional context
I can get into the docker image using the debug part of HAOS. While I know my way around Linux, docker is new to me. I am willing to gather whatever info is needed.

Add an sleep setting

Is your feature request related to a problem? Please describe.

The R900 I use for reading my water meter consumes a lot of CPU and I don't really need a down to the minute reading on water consumption.

Describe the solution you'd like

Add an optional setting to the meter configuration to sleep for x seconds after a message is received

meters:
  - id: 12345678
    protocol: scm
    name: My gas meter
    type: gas
    multiplier: 0.01
    unit_of_measurement: ccf
    sleep_interval: 3600

Support for hexadecimal ids

Is your feature request related to a problem? Please describe.
My meter has an 'A' in its ID, but the schema only supports decimal characters.

Describe the solution you'd like
The configuration to support hexadecimal id's.

Describe alternatives you've considered
None, gated

Additional context
On both my bill, and the meter itself, I have an ID 11A7xxxx (omiting last four digits).

Question regarding MQTT broker connection without credential config

Not really a feature request but more of a question.

Thanks for this great addon, thanks to it, I can get data from my electricity meter and now challenge more my household on energy consumption!

I'm a member of the Theengs team and we have also an addon for the Theengs Gateway, a BLE to MQTT gateway.
One thing that was easy with your addon is that I didn't have to enter my MQTT broker credentials to have the addon login and communicate with the broker.

image

I have checked your config.yaml and compared it to Theengs Addon one, but haven't found what I'm missing to enable Theengs user to have the addon working without entering the credentials.

Any pointers on this?

mihsu81/addon-theengsgw#10

Permissions error on startup.

Fails on startup, bare metal HAAS

Traceback (most recent call last):
  File "/amr2mqtt/amr2mqtt.py", line 18, in <module>
    import settings
  File "/amr2mqtt/settings.py", line 19, in <module>
    with open("/data/options.json", encoding="utf-8") as config_options:
PermissionError: [Errno 13] Permission denied: '/data/options.json'

Add-on version: 2.1.2
System: Home Assistant OS 11.2 (amd64 / generic-x86-64)
Home Assistant Core: 2023.12.3
Home Assistant Supervisor: 2023.11.6

Error

I get this error when trying to start service

[17:53:24] INFO: Starting rtl_tcp daemon...
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

ValueError: invalid literal for int() with base 10: ''

I'm receiving the error "ValueError: invalid literal for int() with base 10: ''" when starting amr2mqtt add-on in Home Assistant 2024.1.3

Is this add-on still being produced / supported?

To Reproduce
Start the add-on

Logs

AMR2MQTT
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 11.4  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.1.3
 Home Assistant Supervisor: 2023.12.0
-----------------------------------------------------------
 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
[12:44:02] 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
[12:44:02] DEBUG: Validate config and look for suggestions
[12:44:03] DEBUG: Requested API resource: http://supervisor/services/mqtt
[12:44:03] DEBUG: Request method: GET
[12:44:03] DEBUG: Request data: {}
[12:44:03] DEBUG: API HTTP Response code: 400
[12:44:03] DEBUG: API Response: {"result": "error", "message": "Service not enabled"}

[12:44:03] ERROR: Got unexpected response from the API: Service not enabled
[12:44:03] INFO: Ensure MQTT broker is reachable at : (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
[12:45:03] DEBUG: Setting MQTT details...
[12:45:03] INFO: Starting rtl_tcp daemon...
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000406

Using device 0: Generic RTL2832U OEM
Found Elonics E4000 tuner
[12:45:03] INFO: Log level set to DEBUG
[12:45:03] INFO: Waiting for rtl_tcp...
Tuned to 100000000 Hz.
Allocating 15 zero-copy buffers
[12:45:04] INFO: Handing over control to AMR2MQTT...
Traceback (most recent call last):
  File "/amr2mqtt/amr2mqtt.py", line 18, in <module>
    import settings
  File "/amr2mqtt/settings.py", line 32, in <module>
    MQTT_PORT = int(os.environ.get("MQTT_PORT"))
ValueError: invalid literal for int() with base 10: ''
Signal caught, exiting!
Signal caught, exiting!
[12:45:04] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
[12:45:04] INFO: Service restart after closing
[12:45:04] INFO: Service restart after closing
s6-svwait: fatal: supervisor died
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
Signal caught, exiting!

This does NOT cause the add-on to stop.

Environment (please complete the following information):

  • Add-on version: 2.1.2 // it appears this version, according to Github, is 30 Aug 2022
  • Supervisor version: 2023.12.0
  • Operating system: 2024.1.3

High CPU usage due to log being flooded

Describe the bug
From time to time I have seen CPU spikes in my Home Assistant instance. I have tracked the usage to AMR2MQTT addon.
During these "high CPU usage interval" the log is being flooded with these messages (hundreds of messages per second):

Error reading samples: EOF

To Reproduce
It's hard to reproduce as it happens at random intervals.

Logs

Error reading samples: EOF

(I will update with more info when it happens again)

Environment (please complete the following information):

  • Add-on version: 2.1.2]
  • Supervisor version: (No idea how to get this)
  • Operating system: Home assistant OS 2022.12.8 (running inside a VM)

Water meter not populating MQTT auto-discovery fields correctly

Describe the bug
I've setup my meter configuration for my water meter. The fields are auto-populated into the MQTT auto-discovery topic incorrectly, which causes HA to not identify the sensor correctly and therefore can't be used in the as an Energy Dashboard water meter consumption sensor.

To Reproduce
Meter configuration:

  • id: ******
    protocol: r900
    name: Watermeter
    type: water
    state_class: total_increasing
    device_class: water
    unit_of_measurement: gal

This is populated into the MQTT auto-discovery consumption config, but it is missing the flag for "device_class". It is also tagged as state_class: "total" instead of "total_increasing"

Expected behavior
Should populate as
state_class: total_increasing
device_class: water

Logs

Include any relevant logs

Environment (please complete the following information):

  • Add-on version: AMR2MQTT Current version: 2.1.2
  • Supervisor version: [e.g.supervisor-2021.03.6]
  • Operating system HA 2022.11.4

Additional context
If i go into MQTT-Explorer and re-publish
Homeassistant\sensor******(myid)\consumption\config and add in the device_class and update the state_class, I am able to find the sensor in the Energy Dashboard Config and select the sensor for water consumption.

Changing anything in the AMR2MQTT config and restarting will cause the MQTT settings to be over-written. I then have to go back in and re-add device_class: water and state_class: total_increasing to get things working again.

Setting Center Frequency

The meter that I am attempting to capture uses 917.58Mhz. I am able to use rtlamr on my PC set to that frequency and I pick up a number of meters. The addon uses 912.38Mhz as the center frequency and is not picking up any meters.

Can an option be added to the addon configuration to set the center frequency?

r900 Isn't Working

I am using this addon with a Nooelec NESDR Mini on an RPI4B and I'm trying to pull data simultaneously from 4 sources:

  1. Electric meter (SCM)
  2. Gas meter (SCM+)
  3. Water meter (r900)
  4. Irrigation water meter (r900)

The electric and gas meters are working well but I am not able to get either of the r900 water meters working. I monitored the MQTT traffic and I'm not seeing any updates for the water meters.

The amr2mqtt logfile reports that it is listening to r900 and it does not have any of those ll+ messages that are indicative of a processing speed issue.

I tried the same dongle on my PC using rtl_tcp and rtlamr and I see the r900 messages show up.

Please let me know if you have any ideas.

amr2mqtt log:

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Detached kernel driver
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Tuned to 100000000 Hz.
[13:47:17] INFO: Log level set to INFO
[13:47:17] INFO: Waiting for rtl_tcp...
Allocating 15 zero-copy buffers
[13:47:17] INFO: Handing over control to AMR2MQTT...
Signal caught, exiting!
Signal caught, exiting!
INFO:root:Starting rtlamr
INFO:root:Connecting to MQTT broker at core-mosquitto:1883
Allocating 15 zero-copy buffers
13:47:18.998596 decode.go:45: CenterFreq: 912600155
13:47:18.999194 decode.go:46: SampleRate: 2359296
13:47:18.999237 decode.go:47: DataRate: 32768
13:47:18.999265 decode.go:48: ChipLength: 72
13:47:18.999291 decode.go:49: PreambleSymbols: 32
13:47:18.999316 decode.go:50: PreambleLength: 4608
13:47:18.999341 decode.go:51: PacketSymbols: 128
13:47:18.999366 decode.go:52: PacketLength: 18432
13:47:18.999403 decode.go:59: Protocols: r900,scm,scm+
13:47:18.999432 decode.go:60: Preambles: 00000000000000001110010101100100,111110010101001100000,0001011010100011
13:47:18.999460 main.go:111: GainCount: 29

PC log (ID changed):

13:45:28.830497 decode.go:45: CenterFreq: 912380000
13:45:28.831142 decode.go:46: SampleRate: 2359296
13:45:28.831142 decode.go:47: DataRate: 32768
13:45:28.831142 decode.go:48: ChipLength: 72
13:45:28.831142 decode.go:49: PreambleSymbols: 32
13:45:28.831683 decode.go:50: PreambleLength: 4608
13:45:28.831683 decode.go:51: PacketSymbols: 128
13:45:28.831683 decode.go:52: PacketLength: 18432
13:45:28.831683 decode.go:59: Protocols: scm,scm+,r900
13:45:28.831683 decode.go:60: Preambles: 111110010101001100000,0001011010100011,00000000000000001110010101100100
13:45:28.831683 main.go:124: GainCount: 29
{Time:2022-04-10T13:45:38.141 R900:{ID:1234567890 Unkn1:0xA3 NoUse:36 BackFlow:0 Consumption:  114880 Unkn3:0x00 Leak: 0 LeakNow:0}}

Meter config (ID changed):

  - id: 12345674890
    protocol: r900
    name: Irrigation Water Meter
    type: water
    multiplier: 0.01
    unit_of_measurement: ft³
    precision: 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.