I was not able to implement the sql solution, it showed me very huge number (sum of low and normal? :S). When I was trying to query it using sqlite UI, then I got errors in the query: “)t;” in the end of select, “AND state != ‘unknown’” does not works
Its not that easy, i plugged my dsmr in a vera to get values in an macos hass docker. Min max value is possible, but you need the min max of a day not last 24h or something.
Hey guys, there recently was a smart meter installed in my home for electricity (Iskra SMR 5.0) and gas (FLonidan SMR 5.0) and the mechanic said he linked them together. I bought the usb/p1 cable on sos solutions and configured the dsmr on my hassio. The readings for electricity seem to be working fine, but I get no gas readings. Did anyone encountered this before and knows how to fix this?
Thanks a lot
no, worked right away for me. You should have two gas consumption readings in HA, one is the usage per hour and the other the total gas usage.
@IvaP, @dotms, thanks for sharing your code! It took me some time to figure out that the file needs to be named same as the original one (and not add v2, copy or whatever). Guess I’m still learning
As for the file itself; I had to make some minor changes in order to get this to work. For example replacing the datetime import to support the time functions and remove the self.log as I got a ‘self is not defined’ error (and I’m not interested in this debugging logging).
In addition I removed all the sensors from the array that I’m not using as this is just pollution my device list in the UI.
What would be nice to add (not sure yet how to realize though):
- configuration to support specification of the update frequency (e.g. similar as in Domoticz). The current change allows for max 60 sec interval; I used to use 300 sec.
- the ‘actual’ power consumption to be the average of the readings over the interval specified earlier. In the current implementation I believe only the update interval is changed and as a result the actual reading is send less frequent. However the actual reading reflects to a moment in time (updated every second?) and all results are discarded in the timeframe where no update is send. It would be nice to still store all values and only send the average of this timeframe instead.
Example:
Assume we get 1 reading per second and we update HASS every 10 seconds as result of the change made earlier. I believe the following is happening.
Data received (current power consumption): 0.410, 0.395, 0.258. 0.560, 1.936, 2.250, 2.168, 1.980, 2.368, 2.201. Data reported to HASS: 2.201 (as this is the 10 second interval)
What I would like to do instead is sum all values and report the average instead which is 1.731 in this case. I’m not a programmer but I believe there should be some way of storing the values in, for example, an array and calculate the average based on the number or items in the array (e.g. to coop with various timeframes).
What do you guys think?
I’m not into the code of HASS lately (in fact I’m not using HASS any more) but the approach of storing the intermediate values in an array seems fine.
For each iteration in your loop check the item count in the array. Once it hits the required number of items calculate the average and send it to HASS.
Just be sure to define that array outside of the loop (to prevent it from being re-initialized every reading and thus never hitting your required number of readings) and to clear its contents after you have calculated the average (to prevent it from getting too big).
The approach is clear; I just don’t understand the dsmr.py code well enough to figure out how to retrieve value for ‘obis_ref.CURRENT_ELECTRICITY_USAGE’ and store this in an array before averaging out and sending to hass.
Apologies for the delay, but better late than never
I personally don’t use my dsmr_custom.py anymore. I use a dedicated Raspberry Pi 3 with DSMR-reader (https://dsmr-reader.readthedocs.io/nl/latest/screenshots.html). DSMR-reader is publishing my stats via MQTT to Home Assistant. Some advantages are very nicely displayed stats inside DSMR-reader and much less load on my HASS.io Raspberry Pi.
I attached my (old) dsmr_custom.py to this post as a .XML-file because file upload restrictions. Just rename the .XML to .py.
dsmr_custom.xml (11.4 KB)
hmm love the looks of the dsmr reader! as I also struggle with high loads for HA I will look into this for sure! Perhaps use it with the new utility meter. As I already have a spare RPi lying around this will be my next project. I might look into doing something similar with my zwave power sensors that record power usage etc as well. As I have quite a few they may also overflow HA with useless info.
Anyone got a V5 meter working over TCP with ser2net?
Wondering the same thing. I’m unable to get the V5 meter working with ser2net. Opening a telnet to the default port 2001, gives me data.
Love to see a solution.
keeping an eye on this topic.
Got it working eventually. Make sure everything in ser2net is corresponding with your serial and HASS settings. It should work perfectly fine.
I bought this cable https://www.robbshop.nl/slimme-meter-kabel?sqr=p1& and I have the same meter (Sagemcom) as you. I connected the cable to my RP3 with Hassio. A red light flashes every second, but my entities don’t show data. My config is:
Sensor.yaml
- platform: dsmr
port: /dev/ttyUSB0
What does your configuration look like? Which DSMR version do you have and where did you buy your cable? I want to get this working with Grafana in frontend.
Dsmr version did the trick! The data is rolling…
Can someone help me with the following question. I have a P1 cable linked to my RP3b+ and the data is rolling in (ISKRA550 on DSMR5, so it updates every second). But it’s flooding and eventually crashing my home-assistant_v2.db file; within a day both history and logbook stop functioning.
I have already hidden the sensors I don’t care about.
What is the best way to ‘slow down’ the DSMR parser to prevent it from flooding the database? I can’t seem to find that option.
–edit–
I found the answer myself. Best way I found is to exclude the DSMR sensors that cause the flooding problem from the HA recorder by adding:
recorder:
purge_keep_days: 5
purge_interval: 1
exclude:
entities:
- sensor.Power_Consumption
- sensor.power_consumption_low
- sensor.power_consumption_normal
- sensor.hourly_gas_consumption
- sensor.gas_consumption
And then add a new sensor by using a filter, to make a new sensor that updates at the desired interval which can be logged:
sensor:
- platform: filter
name: "<name of your filtered sensor here>"
entity_id: sensor.power_consumption
filters:
- filter: throttle
window_size: 10
Problem solved!
option 2:
use an external application called dsmr reader to record your DSMR statistics and use MQTT to publish only the required statistics to HA. HA is currently not ideal for longterm statistics (compared to domoticz)
Is it possible to connect the USB p1 from the smart meter to the same raspberry pi with hassio on it?
Most definitely
That is nice to know. Thanks.
From there I can follow the tutorial steps? No any settings change?
correct. Only if you run it in docker you need to forward the correct usb-port but thats not required in hassio.