Wouldn’t it be possible to publish the values to MQTT and then use a script like: https://github.com/jkairys/mqtt-pvoutput-bridge to read the values into pvoutput?
You could also use dsmrreader
http://dsmr-reader.readthedocs.io/nl/latest/intro.html
It supports uploading to pvoutput and MinderGas and supports MQTT to get your readings in Home Assistant. You can even run dsmrreader inside an iframe in Home Assistant. Both work fine together on a Rpi3 here.
Does anyone know if it is possible to increase the reading frequency of the gasmeter? Data is currently coming in every 50 mins, but would like to increase that (maybe by reading the gasometer directly?)
Just increasing the reading frequency won’t do you any good as you would get the same readings over and over again… ;o|
The gas meter readings are transmitted wireless to the ‘Smart Meter’ (the one with the P1 port). And as you can see, there are no wires connected to the gas meter (for safety reasons), so it’s battery operated. To ensure approx. 15 years lifespan, they reduced the data transmit frequency as specified in the DSMR standard, allowing the battery to last long enough.
Do you guys know if this also works? https://www.p1connector.nl/
Worked great in Domoticz, but HASS doesn’t show anything.
Yes, it also works with a Rapsberry Pi P1 Connector from https://www.p1connector.nl/.
But it is possible that you have to take some actions.
I have it running on a Raspberry Pi 3 with Hassbian, but I had to make some changes:
sudo nano /boot/config.txt
Add at the end of the file
dtoverlay=pi3-disable-bt
sudo nano /boot/cmdline.txt
remove the word phase “console=serial0,115200” or “console=ttyAMA0,115200”
sudo reboot
Than follow the instructions at https://home-assistant.io/components/sensor.dsmr/
Use /dev/ttyAMA0 for the port.
It will look something like this:
sensor:
- platform: dsmr
port: /dev/ttyAMA0
group:
meter_readings:
name: Meter readings
entities:
- sensor.power_consumption_low
- sensor.power_consumption_normal
- sensor.power_production_low
- sensor.power_production_normal
- sensor.gas_consumption
Thanks. I’m on Hassio, that doesn’t work. Any idea if that’s possible?
Edited both files on the SD card according to your post. But nothing in HASS…
This has been working well for quite a while, but I recently had to move to opening up home-assistant so I could use Google Home voice control (with ssl and duckdns) but now the script has stopped working. I tried modifying the script, but my Python skills are not that great. Could you help me out on getting the script to work with SSL enabled?
Managed to get the mindergas script working by using the duckdns domain name and setting the port to 443. Not ideal as I want to keep things local as much as possible, but ok for now.
What script? I use the dsmr component and a basic daily automation with a curl command. You can have a look at my repo, link in my profile.
I’m trying to migrate from Domoticz to HA. I’m capable of reading out the smart meter also with HA but it seems this component is missing to types of data compared to the Domoticz plugin. In the Domoticz plugin I also have these sensors available:
- Total consumption today
- Total production today
Is there anyway to, for instance create a template sensor, to calculate these values?
I have made some modifications to the plugin code to keep it a little more quiet. A whole bunch of sensors updated literally every second really starts clogging up the homeassistant database resulting in a nearly unusable events/states mechanism (86400 state changes a day is a bit much). For now I’ve hacked in a filter that only allows messages coming in on the 20th and 50th second each minute (so update rate is reduced to twice a minute). There are probably better ways to do this but it works for me and I have not found a real place where this plugin is maintained
All changes need to be done in /srv/homeassistant/lib/python3.6/site-packages/dsmr_parser/clients/protocol.py:
At the top of the file add import datetime
.
My new handle_telegram function looks like this:
`def handle_telegram(self, telegram):
“”“Send off parsed telegram to handling callback.”""
allowedseconds = [20, 50]
now = datetime.datetime.now()
if now.second in allowedseconds:
self.log.debug('got telegram: %s', telegram)
try:
parsed_telegram = self.telegram_parser.parse(telegram)
except InvalidChecksumError as e:
self.log.warning(str(e))
except ParseError:
self.log.exception("failed to parse telegram")
else:
self.telegram_callback(parsed_telegram)
else:
self.log.debug('skipping since second %d is not in allowedseconds', now.second)`
I’m willing to cobble together some decent configuration options but I’m unsure where to submit those.
I’ve got the same problem that my InfluxDB is flouded with state changes (DSMR version 5).
On my hassio installation, on a Raspberry Pi 3, I’m not able to find the path via SSH: /srv/homeassistant/lib/python3.6/site-packages/dsmr_parser/clients/protocol.py
Is it possible to make this change on hassio?
Yo could add a template sensor that is updated less frequently and save that instead of the ‘real’ sensor value.
Thanks for your quick reply. But when I check the component page for Template Sensor (https://www.home-assistant.io/components/sensor.template/), I don’t se a option for a interval.
Do I miss something?
I’ve solved it by creating a Custom_Component (config\custom_components\sensor\dsmr_custom.py in my config folder). I copied the original dsmr.py from github (https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/sensor/dsmr.py) and changed:
def update_entities_telegram(telegram):
"""Update entities with latest telegram and trigger state update."""
# Make all device entities aware of new telegram
for device in devices:
device.telegram = telegram
hass.async_create_task(device.async_update_ha_state())
with the following:
def update_entities_telegram(telegram):
"""Update entities with latest telegram and trigger state update."""
# Make all device entities aware of new telegram
allowedseconds = [20, 50]
now = datetime.datetime.now()
if now.second in allowedseconds:
for device in devices:
device.telegram = telegram
hass.async_create_task(device.async_update_ha_state())
else:
self.log.debug('skipping since second is not in allowedseconds',
now.second)
Borrowed some code from @dotms
Now my sensor inside hassio is updating itself every 30 seconds and my database is not getting flooded.
Did you finally get it working? Because I’m trying the same setup and it is not working as excepted.
here my setting for the P1 smart meter in Hassio raspberry pi 2
Example configuration.yaml entry for USB/serial connected Smartmeter
sensor:
- platform: dsmr
port: /dev/ttyUSB0
dsmr_version: 2.2
group:
meter_readings:
name: Meter readings
entities:
- sensor.power_consumption_low
- sensor.power_consumption_normal
- sensor.gas_consumption