Coder Social home page Coder Social logo

cpyarger / home-assistant-addons Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 4.0 2.26 MB

A hass.io addon for a software defined radio tuned to listen for Utility Meter RF transmissions and republish the data via Home Assistant's API

License: MIT License

Dockerfile 13.90% Shell 83.79% Python 2.31%
home-assistant home-assistant-addons rtlamr rtl-sdr utility-monitoring

home-assistant-addons's Introduction

hassio-addons

Repository for hass.io add-ons

Included Addons

  • SDRMR - A hass.io addon for a software defined radio tuned to listen for Utility Meter RF transmissions and republish the data via Home Assistant's API
  • Google Domains DNS - A simple addon that updates the current Google Domains DNS, Made because I had a bunch of issues with the built in google domains integration
  • Git Back Up - (Not Ready Yet!) A Hass.io addon that will automatically backup all yaml files in your /config/ folder using Git and posting to a remote repository. ( Not Ready for use currently )
  • Infinitime - Work in progress addon, Uses BLE to grab data from an infinitime watch and sync that data with home assistant.

home-assistant-addons's People

Contributors

cpyarger avatar pasyn avatar siliconavatar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

home-assistant-addons's Issues

1

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Unable to see r900 signals

Describe the bug
SDR Meter Reader doesn't appear to be locating my r900 water meter, but rtlamr2mqtt is able to see and ingest the data just fine. I have the following config:

debug: false
rtltcpdebug: false
msgType: all
ids: "########"
duration: 600
pause_time: 30
gas_unit_of_measurement: ft³
electric_unit_of_measurement: kWh
water_unit_of_measurement: gal
gas_multiplier: 1
electric_multiplier: 1
water_multiplier: 1

I'm able to start the addone and I get the following in the log (meter ID removed):

Starting RTLAMR with parameters:
AMR Message Type = r900
AMR Device IDs = ########
Time Between Readings = 30
Duration =  120
Electric Unit of measurement =  kWh
Gas Unit of measurement =  ft³
Water Unit of measurement =  gal
Gas Multiplier =  1
Electric Multiplier =  1
Water Multiplier =  1
Debug is  false
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 1090
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Tuned to 100000000 Hz.
Allocating 15 zero-copy buffers
16:08:22.560895 decode.go:45: CenterFreq: 912380000
16:08:22.564007 decode.go:46: SampleRate: 2359296
16:08:22.564147 decode.go:47: DataRate: 32768
16:08:22.564177 decode.go:48: ChipLength: 72
16:08:22.564208 decode.go:49: PreambleSymbols: 32
16:08:22.564237 decode.go:50: PreambleLength: 4608
16:08:22.564265 decode.go:51: PacketSymbols: 116
16:08:22.564294 decode.go:52: PacketLength: 16704
16:08:22.564331 decode.go:59: Protocols: r900
16:08:22.564363 decode.go:60: Preambles: 00000000000000001110010101100100
16:08:22.564474 main.go:124: GainCount: 29
200
16:10:22.602296 main.go:341: Time Limit Reached: 2m0.013775526s
Signal caught, exiting!

For comparsion, here is my rtlamr2mqtt config (meter ID removed)

general:
  sleep_for: 300
  verbosity: debug
  listen_only: false
  tickle_rtl_tcp: false
  device_id: single
mqtt:
  ha_autodiscovery: true
  ha_autodiscovery_topic: homeassistant
  base_topic: rtlamr
  tls_enabled: false
  host: 192.168.86.10
  port: 1883
  user: mqttclient
  password: fORyBoUstoSO
custom_parameters:
  rtltcp: "-s 2048000"
  rtlamr: "-unique=true"
meters:
  - id: ########
    protocol: r900
    name: water_meter
    format: "######.#"
    unit_of_measurement: Gal
    icon: mdi:water

Expected behavior
I'm expecting for the add on to see my water meter and report consumption

Can't install ITD Addon

Describe the bug
When I try to install this Addon I get:
The command '/bin/ash -o pipefail -c apk add --no-cache --virtual build-deps alpine-sdk cmake libusb-dev libusb jq coreutils wget bash make musl-dev go git gcc usb-modeswitch dbus bluez pulseaudio-utils' returned a non-zero code: 16

To Reproduce
Steps to reproduce the behavior:

  1. Go to Addon
  2. Click install
  3. Watch error

Expected behavior
Normal installation

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
Home Assistant 2023.1.4
Supervisor 2022.12.1
Operating System 9.4
Frontend-versie: 20230110.0 - latest

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

User Questions

I started using your SDR Meter Reader add-on today and had a couple questions. I first ran it in msgType: all and then narrowed it down to msgType: scm before finding the ID that matched my gas meter however as a result I now have all of the sensor.xxxxxxxx data for all of the different meters that I picked up. How do I remove those?

My second question is how do I add a second meter id to watch for? When I add a second id separated by a comma it tells me "xxxxxxxxx, " is not a valid id and if I try to add each one in quotes it just deletes the second number.

Edit. After posting I tried it like this "ids: 1234,5678" and so far I've been getting readings for 1234, my gas meter, but my water meter, 5678, hasn't popped up yet though it may only wake up when they come around every month to read it.

Only first ID number is identified, and incorrectly given the gas units

Describe the bug
Only the first ID is identified, and it's incorrectly identified as gas type.

To Reproduce
Steps to reproduce the behavior:

  1. First time install
  2. Add three space-delineated 8-digit meter ID numbers in the "IDs" field.
  3. Input units m3 , kWh , gal
  4. Input multipliers: 0.01, 0.01, 748.1

Expected behavior
Space-delineated IDs to each be used separately, and somehow identified as being either gas, electric, or water automatically.
Each one to be configurable in the Energy Dashboard.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Debian
  • Browser: Firefox
  • Version: Latest

Additional context
If there are instructions regarding delineation of the IDs I have not found it...
And if there's a specific order they should be given, that too is has not been communicated.

Add CCF as a Unit of Measurement

I have been working to rebuild a new HA instance and using this add-in rather than the MQTT one. My gas and water provider meters measure in CCF (centi cubic feet), would it be possible to add that as a measurement options for water and gas? I was looking at the code, but am not sure if I forked this, where I would add the option or calculation for this. (Sorry, not super great at Github or coding stuff yet; have just dabbled)

Describe the solution you'd like
Be able to select CCF for unit of measurement for Water and Gas

Describe alternatives you've considered
I have done the calculation in YAML templates with the MQTT SDR add-in, which works, but would like it to just have the measurement straight from the source. Water would be simple, just diving by 100 to go from ft3 to CCF. But Gas would be different; I know HomeAssistant needs m3 for the dashboard so right now I have a YAML template to convert the CCF to m3, so wouldn't be sure how to handle that within the add-in itself.

Not a huge deal, just figured I'd check. Thanks!

Unable to start SDRMR addon successfully

Describe the bug
Have tried to follow the instructions as best as possible and have attempted to use different ID's for the water/gas/electric components, though I'm unable to get it working. It also seems that it starts, doesn't find any devices, then crashes as it's unable to connect to the spectrum server.

To Reproduce
Steps to reproduce the behavior:

  1. Install the addon following the steps in the readme
  2. Configure the addon
  3. Start the addon
  4. View addon logs

Expected behavior
Start the addon, find the sensors, log the data in Home Assistant.

Screenshots
N/A

Desktop

  • Home Assistant is running on Home Assistant OS
    • Home Assistant 2022.12.7
    • Supervisor 2022.11.2
    • Operating System 9.4

Additional context

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
Starting RTLAMR with parameters:
AMR Message Type = all
AMR Device IDs =
Time Between Readings = 30
Duration =  15
Electric Unit of measurement =  kWh
Gas Unit of measurement =  m³
Water Unit of measurement =  l
Water measurements provided in tenths =  true
SCM PLUS GAS DIVISOR =  1
Debug is  true
No supported devices found.
13:52:54.704732 main.go:90: Error connecting to spectrum server: dial tcp 127.0.0.1:1234: connect: connection refused
rcvr.Connect
main.(*Receiver).NewReceiver
	/go/pkg/mod/github.com/bemasher/[email protected]/main.go:90
main.main
	/go/pkg/mod/github.com/bemasher/[email protected]/main.go:313
runtime.main
	/usr/lib/go/src/runtime/proc.go:250
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1571
s6-rc: info: service legacy-services: stopping
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

Is there possibly a way to continually listen to scans and view the data to determine which ids are the correct ones? Or even if it's setup/working to pickup data?

Water meter not working; Advice on migrating

Describe the bug
I have 1 issue and other is more a general question.

  1. QUESTION: Was just recommended this add-on coming from RTLAMR to MQTT. Was curious what the best approach to changing from RTLAMR to MQTT to this would be. I tried doing a "rip and replace", substituting the new sensors for their MQTT counterparts, which worked, but it threw all my readings off, so ended up restoring a backup. Any recommendations would be appreciated, as I am kind of stumped at the moment on the best way to approach this.

  2. BUG: Working so far for my electric and gas meters, but no my water meter. It picks it up and returns the JSON in the debug log but says "Sending null..." and a sensor is never created for it.

To Reproduce
Steps to reproduce the behavior:

  1. Run the add-on
  2. Watch the debug log

Expected behavior
Pull in the data and create the sensor like electric and gas.

Screenshots
NA

Desktop (please complete the following information):
NA

Smartphone (please complete the following information):
NA

Additional context
Here is what the debug logs shows for the water meter:

{"Time":"2022-05-11T11:44:19.672941168-05:00","Offset":0,"Length":0,"Type":"SCM","Message":{"ID":31500996,"Type":13,"TamperPhy":0,"TamperEnc":0,"Consumption":44805,"ChecksumVal":58702}}
Sending  null  to http://supervisor/core/api/states/sensor.31500996 -- 500

My config:

debug: true
msgType: scm
ids: 32642547,31500996,56916660
duration: 0
pause_time: 0
gas_unit_of_measurement: m³
electric_unit_of_measurement: kWh
water_unit_of_measurement: gal
scm_plus_gas_divisor: 1

Thank you!

Add metric units and divisor for Canadian neptune water meters.

This is the config I was using for the AMR2MQTT but that one doesn't seem to be maintained and isn't supported by the energy dashboard.

  • id: 1548650288
    protocol: r900
    name: AMR_WaterMeter
    type: water
    multiplier: 0.001
    unit_of_measurement: m³
    precision: 4
    manufacturer: Neptune
    model: E-Coder

Can you add m³ to the options and a water divisor?
Also my gas meter is SCM and I would need a divisor for that as well.

  • id: 40605246
    protocol: scm
    name: AMR_GasMeter
    type: gas
    multiplier: 0.01
    unit_of_measurement: ft³
    precision: 3
    manufacturer: iTron
    model: 100G

s6-overlay-suexec: fatal: can only run as pid 1

Describe the bug
's6-overlay-suexec: fatal: can only run as pid 1' when trying to start Add-on

To Reproduce
Steps to reproduce the behavior:

  1. Go to SDR Meter Reader Add-on
  2. Click on Start
  3. Goto Log page
  4. See error 's6-overlay-suexec: fatal: can only run as pid 1'

Expected behavior
no error

Home Assistant OS
Home Assistant OS 8.0
Kernel version 5.15.38
Agent version 1.2.1

Additional context
From my research, the config.yaml file should have the following line:
init: false

This is supposed to correct this issue as the updated s6-overlay in the newer version of Home Assistant is expecting only a single init call.

Can't enter decimal numbers for multipliers

The UI would not allow me to enter 0.01 so I had to switch to the YAML editor to do it.

The multipliers are defined as floats so I don't understand why the UI insists on integers. Perhaps change to:

options:
...
  gas_multiplier: 1.0
  electric_multiplier: 1.0
  water_multiplier: 1.0

[SDRMR] Possible conversion to an integration

So, While this current version works, we are currently unable to give any added sensors a unique_id in home assistant. This leads to an issue where we are unable to use the built in methodologies for changing the sensor names to something a bit more user friendly.

this is due to a limitation in the rest api which is used by addons

Integrations do not have this limitation

Any thoughts on this?

Auto Discover Meters

Add a Discover Meters button that runs rtlamr -msgtype=all for 5-10 minutes to find nearby meters then populates the ID list with the results.

Add ability to format consumption values as decimals

My water meter reports values in tenths of gallons. Is it possible to make the value shown in this output show as 253999.8 gal?

{
    "Time": "2022-06-20T11:16:41.373827852-04:00",
    "Offset": 0,
    "Length": 0,
    "Type": "R900",
    "Message": {
        "ID": 123456789,
        "Unkn1": 163,
        "NoUse": 1,
        "BackFlow": 0,
        "Consumption": 2539998,
        "Unkn3": 0,
        "Leak": 3,
        "LeakNow": 0
    }
}

Add additional gas meter type 30

Can you add an additional gas meter type for Protocol ID 30?
Below is an example of the output of my gas meter

{
    "Time": "2022-06-20T12:24:13.751342404-04:00",
    "Offset": 0,
    "Length": 0,
    "Type": "SCM+",
    "Message": {
        "FrameSync": 5795,
        "ProtocolID": 30,
        "EndpointType": 188,
        "EndpointID": 123456789,
        "Consumption": 601532,
        "Tamper": 2056,
        "PacketCRC": 57150
    }
}

SDR Meter Reader - Electric meter readings do not set state attributes

Water meter which is R900 correctly records state attributes while electric meter which is SCM does not record any state attributes

Screenshot from 2022-05-01 20-41-13
First screencap is from water meter which is working correctly.

Screenshot from 2022-05-01 20-41-42
Second screencap is from electric meter which does not work.

Here is my current sdr meter reader config

debug: false
msgType: all
ids: 23876447,1540559732
duration: 15
pause_time: 30
gas_unit_of_measurement: ft³
electric_unit_of_measurement: kWh
water_unit_of_measurement: gal
scm_plus_gas_divisor: 1

Electric meter is an Itron CL200
SDR is Nooelec RTL-SDR, FM+DAB, DVB-T USB Stick Set with RTL2832U & R820T
I am running the latest haos on a Raspi 4

Tried to grab some relevant portions of the log. It is difficult to catch the right data as the program seems to only run for a time and then restart.

Sending  {"state":"3438056","extra_state_attributes":{"unique_id":"1540559732-sdrmr"},"attributes":{"entity_id":"1540559732-sdrmr","state_class":"total_increasing","unit_of_measurement":"gal","leak":"0","leak_now":"0","BackFlow":"0","NoUse":"32","Unknown1":"163","Unknown3":"0"}}  to http://supervisor/core/api/states/sensor.1540559732 -- 200

Sending  {"state":"22257"}  to http://supervisor/core/api/states/sensor.23876447 -- 200
4

Please let me know if I can provide any other information

Some help getting this running

Hello!
I do not have any experience getting readings from my gas meter, so I've been trying to get this component running because it seems to simplify the process quite a bit. What I've done so far is run it with msgtype: [all] for a night to (hopefully) read the meters around me and see what is around. The add-on created some sensors, for example one called [sensor.701102524] and I see the value of the sensor continually going up, so I assume this is a meter from either my house, or somewhere near my house. However, my next step was to run it wish msgtype: scm, with id: [701102524] (I figure that's the device ID from the sensor). However, now I get this error

/run.sh: line 57: [[701102524: not found

I'm not sure if this is an error with the script, or I'm doing something completely wrong.
Any help would be appreciated, thank you!

Water Meter Entity Associating With Unit of Measurement

The signal from my water meter is being received, but it is not associated with the unit of measurement that I have chosen in the configuration. Because of this, I cannot select my water usage within Home Assistant's energy monitoring interface. Gas works great, however.

Data from the logs:

Allocating 15 zero-copy buffers
13:29:01.392523 decode.go:45: CenterFreq: 912380000
13:29:01.393266 decode.go:46: SampleRate: 2359296
13:29:01.393296 decode.go:47: DataRate: 32768
13:29:01.393308 decode.go:48: ChipLength: 72
13:29:01.393320 decode.go:49: PreambleSymbols: 32
13:29:01.393332 decode.go:50: PreambleLength: 4608
13:29:01.393343 decode.go:51: PacketSymbols: 736
13:29:01.393354 decode.go:52: PacketLength: 105984
13:29:01.393375 decode.go:59: Protocols: scm,scm+,idm,r900
13:29:01.393464 decode.go:60: Preambles: 111110010101001100000,0001011010100011,01010101010101010001011010100011,00000000000000001110010101100100
13:29:01.393508 main.go:124: GainCount: 29
RTLAMR JSON Output
{"Time":"2022-12-17T13:29:04.344522386-05:00","Offset":0,"Length":0,"Type":"SCM+","Message":{"FrameSync":5795,"ProtocolID":30,"EndpointType":171,"EndpointID":71962620,"Consumption":17265,"Tamper":18688,"PacketCRC":25782}}
JSON Output to HA REST API
{"state":"17265","attributes":{"unique_id":"71962620-sdrmr"}}
200
13:29:21.395174 main.go:341: Time Limit Reached: 20.001547545s
Signal caught, exiting!
Signal caught, exiting!

Configuration:

debug: true
rtltcpdebug: false
msgType: all
ids: 13629571,71962620
duration: 20
pause_time: 120
gas_unit_of_measurement: ft³
electric_unit_of_measurement: kWh
water_unit_of_measurement: gal
water_use_tenths: false
scm_plus_gas_divisor: 1

Entity properties:
image

Listen for meters continuosly

Currently rtlamr runs repeatedly for a set period of time (ie 15 seconds). Doesn't this risk missing transmissions from meters? Why not run rtlamr continuously?
Before trying your add-on I was running rtlamr via systemd continuously like this:
ExecStart=/bin/sh -c "/usr/local/bin/rtlamr -msgtype=scm,scm+ -format=json -filterid=56147164,95099776 -unique=true | /usr/bin/jq --unbuffered -c '. |= del(.Message) + .Message' | /usr/local/bin/stdout_httpd -port 8164"

-msgtype=all causes rtl_tcp to overflow

Using all for rtlamr msgtype causes rtl_tcp to flood the log with the following:

ll+, now 1
ll+, now 2
ll+, now 3
ll-, now 0
ll+, now 1
ll+, now 2
ll+, now 3
ll+, now 4
ll+, now 5
ll+, now 6
ll-, now 0
ll+, now 1
ll+, now 2
ll+, now 3
ll+, now 4
ll+, now 5
ll+, now 6
ll+, now 7
ll+, now 8
ll+, now 9
ll+, now 10
ll+, now 11

Issue is know and outlined in this blog post
https://blog.stesoft.com/index.php/2019/02/10/software-defined-radio-with-raspberry-pi-part1/

Author of blog submitted a pull request to upstream rtl-sdr but it was never merged.
osmocom/rtl-sdr#6

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.