Problem with huge value for "usage"

Moderator: leecollings

hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Problem with huge value for "usage"

Post by hyla »

MySensors 1.5, Domoticz 3.5010

Hi,

I've started to implement the gas meter and came across a practical problem I've seen with energy meter and water meter too:

Unfortunately I have not succeeded in retrieving the start value for the pulse count / gase usage from the controller. So what I do is to save
the value in the EEPROM whenever the sensor loses power and to retrieve data from EEPROM when booting up again. Then this value is sent to the controller. That actually works well, problem is: sometimes the value received by the controller is HUGE. Like in the picture:
hugeUsage.jpg
hugeUsage.jpg (98.05 KiB) Viewed 3803 times
Now, I think I may have found the problem but I don't know how to solve it: It seems to have to do with the fact that in my case I had to report a value for usage to the controller that was actually smaller than the one before (my sensor was registering too many pulses so the usage value was too high).
Now, Domoticz seems to interpret that negative amount as a huge positive number. I'd guess a problem with signed/unsigned numbers?

Anyone got an idea what's to be done here?

Thanks for any input,

Christoph

I should mention that it's not possible to delete this huge value. When selecting the value hitting "SHIFT" and "let mouse button" I am asked "Are You sure to remove this value" but it never works ...
RidingTheFlow
Posts: 72
Joined: Friday 11 March 2016 18:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Essex, UK
Contact:

Re: Problem with huge value for "usage"

Post by RidingTheFlow »

Don't send updates that will decrease the meter count.
You can check current meter value and discard attempt to send value that is smaller.
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

Yeah, well. Only, in this case the REAL value IS smaller than before. That's the problem. And this fact is misinterpreted by the controller by introducing an incedibly large number. Which can't be deleted anymore.

Chris
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

Your using the wrong sensor type
Quality outlives Quantity!
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

Can You elaborate? :)

Chris
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

You use a sensor that expects a continues counter
Quality outlives Quantity!
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

Ah, get it. Yes, of course. Because that's what usually happens in the real world:
I'm using gas up, not actually producing it.

:)

Well, okay. You know what I mean :)
Seriously.
Imagine the following. I'm having a sensor which for reasons I have no influence on produces a value, i.e. a count, that has to be corrected from time to time. Manually. These corrections would imply that the count actually decreases instead of increasing.
Is it possible to do such a correction without producing a number with 20 digits in the process as it happens right now?

As I said: I don't know anything about what exactly happens when sending a value to Domoticz but I suppose this problem has got to do with the way those values are represented internally. If I send a negative value (previous value was larger than current value) to a program that only knows positive numbers then the negative number would be interpreted as a huge POSITIVE number. That's what I'm guessing here.
You're obviously the one to tell me I'm wrong ;)

Chris
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

your not wrong...
your sensor type is not supported in domoticz
you can use the custom sensor to log this maybe ?
Quality outlives Quantity!
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

Okay, I see. Right now I'm using an "RFXMeter" for water and gas (which I think should be alright).
When presenting these sensors to Domoticz they are presented as a "watermeter" ...

Code: Select all

gw.present(CHILD_ID, S_WATER);

... and in Domoticz one has to change that to the appropriate type (energy, gas, water and so on). When doing that with gas it says "Waterflow" in the log chart. Where and how can I change that?

And those huge values I talked about in the beginning of this thread: how come one can't delete them? :)

Thnx,
Chris
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

The mysensors water sketch has a waterflow child as well

You can delete all you want, just shift-click with your mouse on the month/year graph, or delete them from the database.

Please note, that you are not using the sensors in a normal way, and i do not give any support for this, counters are incremental, and should never be set to a smaller amount
Quality outlives Quantity!
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

You can delete all you want, just shift-click with your mouse on the month/year graph
No. That's exactly what does not work. I can shift-click the whole day long. The value won't be erased, reason somehow being (again. Just supposing) that the value is insanely huge (did You look at the number? 20 digits?). Sort of a bug, if You will :)

Christoph
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

Please note, that you are not using the sensors in a normal way, and i do not give any support for this
Understood. And understandable. Of course, I'll go on using these sensors, it's the right thing to do. I was just looking into a way to work around some flaws, won't do it again, promised :)
What about my other question: the inscription on the graphic of my gas sensor says "waterflow". How can I change that one?
waterflow1.jpg
waterflow1.jpg (36.68 KiB) Viewed 3715 times
Thanks,
Christoph
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

Please show me the devices tab with this sensor, as it seems this is not a gas sensor, a gas sensor's day values also do not display like this (yellow)
Quality outlives Quantity!
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

Hi,

these are the devices:
Gas_Devices.jpg
Gas_Devices.jpg (64.85 KiB) Viewed 3688 times
And this is the relevant part of my Mysensors code:

Code: Select all

MyMessage flowMsg(CHILD_ID, V_FLOW);        // message for usage
MyMessage volumeMsg(CHILD_ID, V_VOLUME);    // message for volume
MyMessage pcMsg(CHILD_ID, V_VAR1);          // message for sending pulse count

[...]

  gw.present(CHILD_ID, S_WATER);                                            // Register this device as water meter sensor (change to "gas" in Domoticz)
  gw.wait(3);
  gw.send(flowMsg.set(0));                                                  // Send dummy flow value to gw
  gw.wait(3);
    
[...]
 
  gw.send(pcMsg.set(pulseCount));                                           // send pulseCount to gw
  gw.wait(3);

  gw.send(volumeMsg.set((float)pulseCount / (float)PULSE_FACTOR, 2));       // Send current volume value to gw
  gw.wait(3);
 
Yes, I know I am registering my gas meter as a water meter. Only, I couldn't find 'S_GAS', so I use 'S_WATER' and change that in Domoticz into "Type Gas", at least for the "usage". Seems to work.
ChangeType.jpg
ChangeType.jpg (42.69 KiB) Viewed 3688 times
How is it done correctly? :)
Chris
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

How do you mean there is no S_Gas ? There is...
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

But changing it to gas is also an option
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Problem with huge value for "usage"

Post by gizmocuz »

Take a note of the gas divider in the domoticz settings page
Quality outlives Quantity!
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

gizmocuz wrote:How do you mean there is no S_Gas ? There is...
NoGas.jpg
NoGas.jpg (103.6 KiB) Viewed 3677 times
Using Arduino 1.6.5 and mySensors 1.5 ...

Christoph
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

gizmocuz wrote:But changing it to gas is also an option
As I wrote, all I can change when registering my meter as "S_WATER" is the type for the "usage". "Flow" has got no editable features...

Chris
hyla
Posts: 36
Joined: Tuesday 08 September 2015 16:44
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Location: Germany
Contact:

Re: Problem with huge value for "usage"

Post by hyla »

gizmocuz wrote:Take a note of the gas divider in the domoticz settings page
That's set correctly, I think. The resulting numbers are plausible ...

Chris
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest