Jansemar / PZEM004Tv30MULTI

An Arduino library to connect multiple PZEM004T version 3 sensors to one serial port.
MIT License
0 stars 0 forks source link

Not a problem, Only need example code for ‘get and set’ Power alarm functions; #1

Open lost-bro opened 3 years ago

lost-bro commented 3 years ago

I can’t seem to get the ‘getPowerAlarm()’ function to output a usable response. Does the returned value (boolean) in this case represent that the power alarm is ‘triggered’? Or does it only signify that a value has been added to the ‘setPowerAlarm’ register? At this point when I use setPowerAlarm(); and then try and validate if the overload wattage was written to the register, a Zero is always returned. If you could point me in the direction of an example of working code for the ‘get and set’ Power alarm functions, it would be very much appreciated. Thanks in advance.

I am using a Chinese Arduino nano clone, all other functions work perfectly for my application so the only issue seems to be the configuration of the power alarm.

Thanks in advance. mjd

Jansemar commented 3 years ago

The *PowerAllarm() functions are useless. If you need an alarm u can do a simple if(_currentValues.power > ALARMTRIGGER_VALUE) {DO SOMETHING};

To my understanding the power alarm on the device does nothing besides storing a value. It’s not gonna beep, flash or something like that.

Grz.

Marcel

Van: lost-bro notifications@github.com Verzonden: donderdag 31 december 2020 03:37 Aan: Jansemar/PZEM004Tv30MULTI PZEM004Tv30MULTI@noreply.github.com CC: Subscribed subscribed@noreply.github.com Onderwerp: [Jansemar/PZEM004Tv30MULTI] Not a problem, Only need example code for ‘get and set’ Power alarm functions; (#1)

I can’t seem to get the ‘getPowerAlarm()’ function to output a usable response. Does the returned value (boolean) in this case represent that the power alarm is ‘triggered’? Or does it only signify that a value has been added to the ‘setPowerAlarm’ register? At this point when I use setPowerAlarm();, A Zero is always returned. If you could point me in the direction of an example of working code for the ‘get and set’ Power alarm functions, it would be very much appreciated. Thanks in advance.

I am using a Chinese Arduino nano clone, all other functions work perfectly for my application so the only issue seems to be the configuration of the power alarm.

Thanks in advance. mjd

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Jansemar/PZEM004Tv30MULTI/issues/1 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AHSLYQCKS2ENSJHQE75PVK3SXPPWRANCNFSM4VO6PS4A . https://github.com/notifications/beacon/AHSLYQC3KDBLN4P4UTJTJ4LSXPPWRA5CNFSM4VO6PS4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4LSL7ESQ.gif

lost-bro commented 3 years ago

Happy New Year! Thanks for the fast reply: OK< yes I understand that only a value is stored in the registry - no special effects.....LOL. If I understand correctly:

int ALARMTRIGGER_VALUE = pzem.getPowerAlarm(uint8_t slave_addr); if(_currentValues.power > ALARMTRIGGER_VALUE) {DO SOMETHING};

Seems my big issue is trying to retrieve the value that is stored with function: pzem.setPowerAlarm(1200);

'1200' is of course my max. watt alarm setting.

Thanks in advance. mjd