gw.request - how is it done?
-
Hi,
this is my workaround for my problem:
Ive added a 1F goldcap capacitor as an emergency power supply.
If my powersupply voltage drops a routine is called which stores
the current counter value via gw.setState() and then enters an
endless loop. And an LED is switched on to empty the capacitor.
Next time the sensor boots up, first thing it'll do is to retrieve the
old value for the pulsecount from the EEPROM.With this I can use the setstate function in case it's necessary
but I don't have to write to the EEPROM continuously which
wouldn't work for long (100k write cycle limit).It's probably not failsafe. For example: what happens if there
are multiple reboots because the brownout watchdog "barks"
and the final power cut happens while the EEPROM is written to?But for now it seems to work. Dah!
:)
Christoph -
I have made a sketch requesting VVAR1 from Domoticz. It didnt work with the stable version but better with the beta.
But as i wrote in this post im still having issues with getting the request back: http://forum.mysensors.org/topic/2116/hard-to-grab-time-and-value-sent-from-controllerThe sketch is in the link, but its a rain gauge.
-
@Mediacj sure. It's not cleaned up. And a hack of various sources.
I guess You won't mind ;)
EnergyMeterPulseSensorGrace.inoThe fun stuff happens in the void graceful() routine.
First of all You'll have to run this line once to set Your startup value:
pulseCount = ((1912810 * PULSE_FACTOR / 10) + 5) / 10; graceful();After that You can comment this out and hopefully won't ever need it again :)
With the next booting of the sensor the value will be read from the EEPROM:pulseCount = 0;
pulseCount += gw.loadState(GRACE + 3); // get highest byte
pulseCount *= 256;
pulseCount += gw.loadState(GRACE + 2);
pulseCount *= 256;
(and so on).If the pre-voltage-regulator voltage drops the gold cap will still hold enough power
to save the current value to the EEPROM.Still. I'd much prefer the software solution ...
Christoph
-
I have made a sketch requesting VVAR1 from Domoticz. It didnt work with the stable version but better with the beta.
But as i wrote in this post im still having issues with getting the request back: http://forum.mysensors.org/topic/2116/hard-to-grab-time-and-value-sent-from-controllerThe sketch is in the link, but its a rain gauge.
@sundberg84 I'll have a look at that.
I've just tried the TimeAwareSensor example mentioned and it doesn't work.
But I DO get some reads, as far as I could see I got them from those
sensors that are repeater enabled.
But NEVER anything from "GW". WHat's it's address anyway?Christoph
-
Gizmocuz has a working sketch example
I have successfully used it.