Autor Thema: Neues Modul: WaterCalculator  (Gelesen 28919 mal)

Offline ladislav

  • Newbie
  • Beiträge: 1
Antw:Neues Modul: WaterCalculator
« Antwort #135 am: 22 September 2022, 22:06:37 »
Hello everybody,

I have got an issue with reading/writing values from MYSENSORS.

Mysensors device sometimes asks to previous value. I think it gets the previous value from "" which is multiplied by 2.
I have seen in log file error on line 857 - WaterCountReadingValuePrevious

Did any of you have the same problem?

2022-09-21_21:13:23 MYSENSOR_35 value135: 126125
2022-09-21_21:13:23 MYSENSOR_35 volume35: 1261.250
2022-09-21_21:32:38 MYSENSOR_35 parentId: 0
2022-09-21_21:32:38 MYSENSOR_35 SKETCH_NAME: Water Meter
2022-09-21_21:32:38 MYSENSOR_35 SKETCH_VERSION: 1.1
2022-09-21_21:32:41 MYSENSOR_35 value135: 126125
2022-09-21_21:33:12 MYSENSOR_35 value135: 252250
2022-09-21_21:33:12 MYSENSOR_35 volume35: 2522.500
2022-09-22_00:00:01 MYSENSOR_35 volume35: 2522.500
2022-09-22_00:53:37 MYSENSOR_35 value135: 252251
2022-09-22_00:53:37 MYSENSOR_35 volume35: 2522.510
2022-09-22_07:09:22 MYSENSOR_35 value135: 252252
2022-09-22_07:09:22 MYSENSOR_35 volume35: 2522.520
2022-09-22_08:19:36 MYSENSOR_35 value135: 252253
2022-09-22_08:19:36 MYSENSOR_35 volume35: 2522.530
2022-09-22_13:52:39 MYSENSOR_35 value135: 252254
2022-09-22_13:52:39 MYSENSOR_35 volume35: 2522.540
2022-09-22_15:30:32 MYSENSOR_35 value135: 252255
2022-09-22_15:30:32 MYSENSOR_35 volume35: 2522.550
2022-09-22_15:40:00 MYSENSOR_35 value135: 252256
2022-09-22_15:40:00 MYSENSOR_35 volume35: 2522.560
2022-09-22_18:58:22 MYSENSOR_35 value135: 252257
2022-09-22_18:58:22 MYSENSOR_35 volume35: 2522.570
2022-09-22_19:09:52 MYSENSOR_35 value135: 252258
2022-09-22_19:09:52 MYSENSOR_35 volume35: 2522.580
2022-09-22_19:36:26 MYSENSOR_35 value135: 252259
2022-09-22_19:36:26 MYSENSOR_35 volume35: 2522.590
2022-09-22_21:30:00 MYSENSOR_35 value135: 252260
2022-09-22_21:30:00 MYSENSOR_35 volume35: 2522.600
2022-09-22_21:44:14 MYSENSOR_35 parentId: 0
2022-09-22_21:44:14 MYSENSOR_35 SKETCH_NAME: Water Meter
2022-09-22_21:44:14 MYSENSOR_35 SKETCH_VERSION: 1.1
2022-09-22_21:44:19 MYSENSOR_35 volume35: 2522.600
2022-09-22_21:44:49 MYSENSOR_35 value135: 504520
2022-09-22_21:44:49 MYSENSOR_35 volume35: 5045.200
2022-09-22_21:45:43 MYSENSOR_35 value135: 504521
2022-09-22_21:45:43 MYSENSOR_35 volume35: 5045.210

Offline rob

  • Sr. Member
  • ****
  • Beiträge: 634
Antw:Neues Modul: WaterCalculator
« Antwort #136 am: 20 Oktober 2022, 12:57:29 »
Hi ladislav.

...Mysensors device sometimes asks to previous value. I think it gets the previous value from "" which is multiplied by 2...
I think the device WaterCalculator doesn't change readings of its source device by default. It just catches the events as defined, performs lots of sophisticated calculations with the event's value and writes the results into the readings of the WaterCalculator-device.

I guess there could be two reasons why your volume gets doubled:
1) you have set up any other device in FHEM what changes "volume35" - e.g. a notify, DOIF etc.
2) there could be a multiplication by 2 inside your sketch or oldvalue gets added to newvalue etc.

You could check that if you disable your WaterCalculator temporarily by
attr <YourWaterCalculator> disable 1power down your MYSENSOR-device, set your value135 to a specific one (e.g. 111)
setreading MYSENSOR_35 value135 111and repower/ reboot your MYSENSORS device.

If volume135 doubles again (222), the problem could be 2), if not pls. check if you have any device defined which interferes with volume35 e.g. by
list DEF=.*volume35.*When the problem comes out of the sketch you could create a new post in the MySensors subforum (,96.0.html).

Kind regards

details are more MYSENSOR related and off topic here
My water counting device is even a MYSENSOR thing. I flashed the water counter sketch taken from the MySensor's page. In my case it behaves like that:
- powering/ rebooting - device catches last value from controller (FHEM device)
- device sends value = caught value and sketch information
- device works with that value as a offset and adds new counts to that value as soon as the real counter changes (new pulses)
- volume gets just calculated inside the sketch (value multiplied by factor, because 1 pulse is usually not 1m³ - factor means therefore: how many pulses does it need to get 1m³)
- when I have to correct value, I have to power down my device, set reading by
setreading <MySensorsDevice> value11 1234and repower my device - value and volume appear a few seconds later in FHEM

Offline Sailor

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2267
  • und es werden immer mehr...
Antw:Neues Modul: WaterCalculator
« Antwort #137 am: 08 November 2022, 20:40:55 »
Ein herzerfrischendes "Moin" vom Achtern Diek vorweg!

Aufgrund eines Bugs in den
mit den Anzahl der Sekunden pro Tag während der Zeitumstellung sowie dem Start der Mitternachtsroutine, bin ich gezwungen die Bibliothek "DateTime" zu verwenden.

Daher bitte unbedingt vor dem Update im linux shell die Bibliohek DateTime nachinstallieren:
sudo cpan install DateTime

Ansonsten schmiert Euch euer fhem ab und legt sich in eine Dauer-Startschleife.

Sorry für die Unannehmlichkeiten, aber es ging leider nicht anders.

Man wird immer besser...