Closed kajmaj closed 5 years ago
Have a look into Tasmota wiki/home assistant at the end of the page. The code is not sync to latest hass version (88.1) so there is a need for a small fix (see the PR for Tasmota switch) Give me a few days and I will add more info and sync to latest
Thanks for info. I will wait for update, it is a good job anyhow
Checkout README.asciidoc
So far I use data ( 100 lt = +1) stored in EEPROM. In my case it is 500 writes per year (50 m3 per year/season going though related watermeter) so wemos should last at least a few years.
I´ve tested your counter (watermeter) and it works well but there are a few issues I guess.
Do you work with those two issuaes somehow?
Good questions:
There is no need to do anything with Tasmota, the custom component should just work. This is the all point. It saves the absolute reference in HASS database and NOT in the flash (no need to save anything in flash, no need for any rule). So even if you have many power losses and wifi disconnections you won't miss even one pulse.
The Tasmota internal counter is 64bit (~2E19 pulses) which is a few 1E12 years (even in your case with 1 cube per day) -- I believe you will have a power down/reset/watchdog way before you will get to this number :-)
The hass code knows how to handle the case of small Tasmota counter (32bit) but again there is no need for this code
The Hass counter is unlimited (python int)
Counterdebounce setting -- you should do it once and it saved into the flash (I set it to 1000msec) . No need for this component to mess with it and it saved over power loss/ OTA update.
Make sense?
If I understood well, it is all about the math in template.
No. There are two layers of logic that this simple custom component solves.
hass.tasmota_counter.value
and it is persistence. 140*value/4500 litter
In short the custom component will do the job with raw Tasmota, there is no need to do anything from your side (just write once the debounce and TelePeroid) The only thing that can't be done -- is to count pulses while Tasmota has power loss.
Let me know if it works for you?
One more thing you can do:
You can checkout AppDaemon app CWaterMonitor
for monitoring the water consumption, notify in cases of irregularity like leakage etc.
Under the math I meant "second layer" it is easy to set up in Hass. Counting can be interrupted ( during the measuring cycle) by more reasons:
I am going to test it more thoroughly.
Will check CWaterMonitor
as well.
Thank you
This is correct. This component solves the issues you mentioned too. This is the nice thing about it - no need for any tricks from Tasmota side. I will close this issue and you could open a new one in case you find an issue.
BTW you could do this check. Go to Tasmota code and change the default value (value after reset) of the counter to be 0xFFFF,FFFF,FFFF,FFFF - 20 and consume a few liters and check hass value
I’ve looked into Tasmota code. The counter is 32bit and not 64bit. However the conclusions are the same.
I am testing it at the moment, it is perfect. Just one question - any possibility to reset your counter sensor?
Why would you want to do that? The Hass counter should match the counter in the water meter. a workaround would be to change the formula. Another option you can use the "accumulator" custom component that will provide per day/week/month aggregation
You are right, if I am thinking back - it would not have any sense.
I will try to commit it to hass repo (never did that), let's see how it goes
Did you succeed with your commitment to the hass repo?
Meanwhile, after update to 88.0 there popped up a warning in hassio:
Integrations need to be in their own folder. Change sensor/tasmota_counter.py to tasmota_counter/sensor.py. This will stop working soon.
yes, this is known. This is part of the change I need to do. The model has changed now Sensors/Switch/Binary-sensors are under the domain (tasmota)- I think it is better. So the new component would be
sensor:
tasmota:
type: counter
..
Will update
Have a look into the new commit -- there was a small change in counter definition
thanks for update. Another question: Accumulator can aggregate different values than on/off time as well? As you said before - daily, weekly consumption, etc?
It maintained the total time an entity is in a specific state (e.g. the total time a water tap is opened week/day/month) without running a query in the database (slow)
How to install your tasmota_counter ? For me if I copy the sensor.py into custom_components\tasmota_counter, I got a an error during checking
Just copy all custom_components and copy the usage from pkgs/water
Just copy all custom_components and copy the usage from pkgs/water
Thanks I managed to install... now checking is ok but I got this error "the following components and plateforms can not be set up: -tasmota -tasmota.switch
Here is my sensor.yaml input
My tasmota console infos:
08:31:50 MQT: tele/ECS/STATE = {"Time":"2019-05-20T08:31:50","Uptime":"0T00:19:08","Vcc":2.786,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":26,"Wifi":{"AP":1,"SSId":"sebydocky","BSSId":"5C:33:8E:CD:27:FC","Channel":6,"RSSI":46,"LinkCount":1,"Downtime":"0T00:00:09"}} 08:31:50 MQT: tele/ECS/SENSOR = {"Time":"2019-05-20T08:31:50","COUNTER":{"C1":10700},"ENERGY":{"TotalStartTime":"2019-05-19T13:44:19","Total":4.751,"Yesterday":2.811,"Today":1.940,"Period":0,"Power":0,"ApparentPower":0,"ReactivePower":0,"Factor":0.00,"Voltage":0,"Current":0.000}}
Got last HASSIO version 0.93.1
Any tips ?
it should be under sensor
sensor:
- platform: tasmota
name: Eau_chaude_sanitaire
stopic: ECS
id: 1
unit_of_measurement: 'l'
icon: mdi:water-pump
expire_after: 300
value_template: "{{ (45497 + (value))|int }}"
it should be under sensor
sensor: - platform: tasmota name: Eau_chaude_sanitaire stopic: ECS id: 1 unit_of_measurement: 'l' icon: mdi:water-pump expire_after: 300 value_template: "{{ (45497 + (value))|int }}"
Yes but was already in sensor.yaml
and of course in configuration.yaml I got sensor: !include sensor.yaml
In that case it should work. Provide the full error
In that case it should work. Provide the full error
Where can I found the full long ? I found nothing in general information of system log
My hass version is 89.1. It might be related. let me sync to latest and recheck
Tanks a lot. do i need also to install appdeamon too ? for this particular conpound ?
To use this sensor you just need the custom_component. If you want to leverage the water_app (to find irregularities and notify ) you will need Appdaemon
No I woud like just:
AppDaemon is not needed
At the moment I am on Home Assistant 0.92.2, tasmota does not work
Log Details (ERROR)
Mon May 20 2019 17:05:57 GMT+0200 (Středoevropský letní čas)
Unable to prepare setup for platform tasmota: Unable to set up component.
Error during setup of component tasmota
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 153, in _async_setup_component
hass, processed_config)
File "/config/custom_components/tasmota/__init__.py", line 84, in async_setup
for device in cfg.get(CONF_DEVICES):
TypeError: 'NoneType' object is not iterable
Assuming, that error is related to the latest HA changes
Good, the error is reproductable …. I guess should be an easy fix for you
fix is here https://github.com/hhaim/hass/commit/44a7b015dc7f7de7810eb7bd2c45828a6348a0aa I never tested it only with counter sensor ..
BTW it is wasn't related to the hass version (it works with latest) with one sensor now
fix is here 44a7b01 I never tested it only with counter sensor ..
Thanks :) I will test and report asap I will be home. Actually got one unique water flow sensor…. soon another one will be Added.
After 6 months with the pulse water meter I would buy a RS485 one instead. There is a need to tune the Debouching value
RS485
Too many problem with the Tasmota & HASS ?. Actually I also spent some time with the PZEM-004T to monitor my electricity input…. Tasmota serial link can freeze easily. Maybe the pulse counter are already here with ESPhome …. can be a nice alternatve
There are no issues. Pulse is not that accurate because the pulse can debouching. Tasmota works great. It just an electric property of the pulse. With RS 485(e.g. SDM 630) there is no issue
Ok now it's working no more error..... Now I have to understand how to tune with my count. I benchmark 400 pulses for 1 liter. How to scale with my own setting ?
I tried:
value_template: "{{ ((value)|float/400.0)| round(2) }}"
it's not the right value....
Try this value_template: "{{ (0 + (value/400.0))|int }}"
Should be more or less ok I observed that in the scope
value 1419 old value 20551 uptime sec 750
As you can see the "old value" is the total count.... I don't know if your module reset automatically these counting in tasmota ?
Looks good. Tasmota counter value is not persistence. This is the objective of this module
Ok :) .... It's not yet clear in my mind but if it's ok for you. Did you worked a bit how to perform the
I’m using grafana for that
ho maybe it's possible to share an example with grafana ? I just installed it ... I am also new with ... sorry to bother you :(
Sure, will do
Hi, your tasmota_sensor looks promising :) Would it be possible to add any description? I've tried to test it, but simple adding of
tasmota_counter.py
seems to be not the proper way.