letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.26k stars 2.21k forks source link

rules delay to post vcc on deepsleep #870

Closed rene9900 closed 6 years ago

rene9900 commented 6 years ago

i made a topic at letscontrolit forum, and was asked to post the url here since it may be some fault in the firmware, https://www.letscontrolit.com/forum/viewtopic.php?f=4&t=4824

i have a eps8266-01 running ESPEASY 120, red led cut off for lowest power consume possible, it wake up on reset, and i ordered some LIPO's on ebay, want to try see how long it runs on battery. problem i have now is to make it publish VCC waking up then going to sleep, it works perfect if deep sleep is disabled but not if it is on, then all it publish is the online message, i made rules for delaying the boot so it has time to read the vcc correct..this is my rule set, can any of you locate the "problem"? skaermbillede 2018-02-10 kl 23 17 07-1

uzi18 commented 6 years ago

Try to use Delay command instead Timer, and just after Delay Publish in System@Boot event

rene9900 commented 6 years ago

i just tried delay command, changed rules to this:

On System#Boot do Publish /%sysname%/status,%sysname%_Online gpio,15,1

delay 8000 Publish /%sysname%/VCC,%vcc% Publish /%sysname%/Time,%systime% endon

result is:

EVENT: System#Boot ACT : Publish /8266-5/status,8266-5_Online ACT : gpio,15,1 SW : GPIO 15 Set to 1 ACT : delay 8000 MQTT : Topic: /8266-5/status MQTT : Payload: 8266-5_Online ACT : Publish /8266-5/VCC,-1.00 ACT : Publish /8266-5/Time, 0:00 NTP : NTP sync requested NTP : NTP send to 195.137.195.250 NTP : NTP replied! MQTT : Topic: /8266-5/VCC MQTT : Payload: -1.00 MQTT : Topic: /8266-5/Time MQTT : Payload: ,0:00 SYS : 4.47 EVENT: VCC#VCC=4.47 Enter deep sleep... state: 5 -> 0 (0) rm 0 del if0 usl

Grovkillen commented 6 years ago

Try this?

On System#Boot do
Publish /%sysname%/status,%sysname%_Online
gpio,15,1
Publish /%sysname%/VCC,[VCC#VCC]
Publish /%sysname%/Time,%systime%
endon

If [VCC#VCC] and not %systime% is reported using this rule my idea is that the variables are not populated but values are. That would be the bug we're looking for.

uzi18 commented 6 years ago

Try also delay with 25000 as vcc is not measured or change ADC plugin delay.

rene9900 commented 6 years ago

i tried On System#Boot do Publish /%sysname%/status,%sysname%_Online gpio,15,1 delay 8000 Publish /%sysname%/VCC,[VCC#VCC] Publish /%sysname%/Time,%systime% endon

Got Result:

EVENT: System#Boot ACT : Publish /8266-5/status,8266-5_Online ACT : gpio,15,1 SW : GPIO 15 Set to 1 ACT : delay 8000 MQTT : Topic: /8266-5/status MQTT : Payload: 8266-5_Online ACT : Publish /8266-5/VCC,0.00 ACT : Publish /8266-5/Time, 0:00 NTP : NTP sync requested NTP : NTP send to 95.154.26.34 NTP : NTP replied! MQTT : Topic: /8266-5/VCC MQTT : Payload: 0.00 MQTT : Topic: /8266-5/Time MQTT : Payload: ,0:00 SYS : 4.47 EVENT: VCC#VCC=4.47 Enter deep sleep...

still no vcc or system time :(

uzi18 commented 6 years ago

Use delay 25000

14.02.2018 6:05 PM "rene9900" notifications@github.com napisał(a):

i tried On System#Boot do Publish /%sysname%/status,%sysname%_Online gpio,15,1 delay 8000 Publish /%sysname%/VCC,[VCC#VCC] Publish /%sysname%/Time,%systime% endon

Got Result:

EVENT: System#Boot ACT : Publish /8266-5/status,8266-5_Online ACT : gpio,15,1 SW : GPIO 15 Set to 1 ACT : delay 8000 MQTT : Topic: /8266-5/status MQTT : Payload: 8266-5_Online ACT : Publish /8266-5/VCC,0.00 ACT : Publish /8266-5/Time, 0:00 NTP : NTP sync requested NTP : NTP send to 95.154.26.34 NTP : NTP replied! MQTT : Topic: /8266-5/VCC MQTT : Payload: 0.00 MQTT : Topic: /8266-5/Time MQTT : Payload: ,0:00 SYS : 4.47 EVENT: VCC#VCC=4.47 Enter deep sleep...

still no vcc or system time :(

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/letscontrolit/ESPEasy/issues/870#issuecomment-365675539, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHOU9DOn55-Y4rLadIxzjlYFpohTmspks5tUxJTgaJpZM4SFCsl .

rene9900 commented 6 years ago

@25000 it's basicly the same :( i also tried with a esp8266-12 chip on a breadboard to test if it was the -01 model based error, but it have same issue

EVENT: System#Boot ACT : Publish /8266-5/status,8266-5_Online ACT : gpio,15,1 SW : GPIO 15 Set to 1 ACT : delay 25000 MQTT : Topic: /8266-5/status MQTT : Payload: 8266-5_Online pm open,type:2 0 ACT : Publish /8266-5/VCC,-1.00 ACT : Publish /8266-5/Time, 0:00 NTP : NTP sync requested NTP : NTP send to 192.36.143.130 NTP : NTP replied! MQTT : Topic: /8266-5/VCC MQTT : Payload: -1.00 MQTT : Topic: /8266-5/Time MQTT : Payload: ,0:00 SYS : 4.47 EVENT: VCC#VCC=4.47 Enter deep sleep... state: 5 -> 0 (0) rm 0 pm close 7 del if0 usl

uzi18 commented 6 years ago

@Grovkillen fix provided, but as usual someone need to test it :)

uzi18 commented 6 years ago

With this patch it is not needed to use Rules anymore, just for special cases we provide System#Sleep event.

rene9900 commented 6 years ago

correct me if im wrong, but i just put in the code on my arduino ide inside the ESPeasy.ino in the void loop right? im getting compile errors on ESPEasy:683:27: error: 'isDeepSleepEnabled' was not declared in this scope if (isDeepSleepEnabled()) ^

uzi18 commented 6 years ago

Travis said everything is fine :)

uzi18 commented 6 years ago

@Grovkillen @TD-er is it fine for You?

TD-er commented 6 years ago

I will look at it this evening.

uzi18 commented 6 years ago

Have some new ideas for rules processing improvement but need to find solution to compile ESPEasy in eclipse or Arduino IDE.

TD-er commented 6 years ago

Compiling in Arduino IDE is not that hard. Just make a symbolic link (is also possible in Windows) to the src dir with "ESPEasy" as name and open that in the Arduino IDE. Then also copy the libraries folder to the lib dir of your portable Arduino sketch directory. Use portable installation, or else you'll get conflicts with other libraries installed in the Arduino IDE.

uzi18 commented 6 years ago

Need to install esp8266 v 2.3.0 or something else? How You define to build with plugin testing/development?

I dont want to mess with my libs used in rest of my projects. Arduino builder has got some improvements waiting in PRs to generate cmake independent project from arduino sources, will try it.

15.02.2018 4:39 PM "Gijs Noorlander" notifications@github.com napisał(a):

Compiling in Arduino IDE is not that hard. Just make a symbolic link (is also possible in Windows) to the src dir with "ESPEasy" as name and open that in the Arduino IDE. Then also copy the libraries folder to the lib dir of your portable Arduino sketch directory. Use portable installation, or else you'll get conflicts with other libraries installed in the Arduino IDE.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/letscontrolit/ESPEasy/issues/870#issuecomment-365965190, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHOU63MQW9wuzRIeqg0yezdIVM0aaD4ks5tVE-agaJpZM4SFCsl .

rene9900 commented 6 years ago

will the ESPeasy.ino file be up for download? apparently i cant figure out how to change it :(

uzi18 commented 6 years ago

go here: https://raw.githubusercontent.com/uzi18/ESPEasy/6ae4fbc393674fdf1e53546fd5e533e0e84b3f26/src/ESPEasy.ino

copy whole page and replace in ESPEasy.ino

rene9900 commented 6 years ago

im getting all sorts of errors, mine is the R120 i see this ino is for mega, the R120 was the only one i could fit on my esp-01

uzi18 commented 6 years ago

It's a bit ancient.

rene9900 commented 6 years ago

yeah, but it did compile, i updated to 2.3.0 arduino core and tried with mega again, and all is a mess haha

rene9900 commented 6 years ago

i finally succeeded in compiling the mega on core 2.30 with no lib errors "yay" uploaded to my esp-12 and it works, when i change the ino to the fixed one i do get a odd error 'thisBinaryMd5' was not declared in this scope but as the Build | 20100 - Mega (core 2_4_0) reports mqtt vcc as it should im happy, now ill need to see if the -01 will accept the mega, is there no way to run espeasy as minimal ?

TD-er commented 6 years ago

It looks like you're not cherry picking commits, but just files. That's always a bit dangerous in the sense that you may run into bugs.

I was told the core 2.3.0 is already so 'big', that you'll have to strip almost all to fit into 512k. Also the SPIFF may take a relatively big part from the 512k.

rene9900 commented 6 years ago

Well thanks for the help all of you, im happy 👍 IDE serial monitor outputs correctly now on my esp-12

INIT : Booting version: (custom) INIT : Rebooted from deepsleep #2 FS : Mounting... FS : Mount successful, used 76304 bytes of 113201 CRC : No program memory checksum found. Check output of crc2.py CRC : Settings CRC ...OK CRC : SecuritySettings CRC ...OK INIT : Free RAM:25408 INIT : SPI not enabled WIFI : AP Mode disabled WIFI : AP Mode ssid will be 8266-5_22 with address 192.168.4.1 IP : Static IP :251766976 WIFI : Connecting WIFI attempt #1 Current Time Zone: STD time start: 2018-10-28 03:00:00 offset: 60 min WIFI : Connected! IP: 192.168.1.15 (8266-5_22) MQTT : ClientID 8266-522 connected to broker Subscribed to: /8266-5 EVENT: System#Boot ACT : delay 2000 ACT : Publish /8266-5/status,8266-5_Online ACT : gpio,15,1 SW : GPIO 15 Set to 1 ACT : Publish /8266-5/Time,09:10:08 ACT : Publish /8266-5/ip/IP,192.168.1.15 WD : Uptime 0 ConnectFailures 0 FreeMem 20688 SYS : 4.47 EVENT: VCC#VCC=4.47 EVENT: Clock#Time=Fri,09:10 EVENT: System#Sleep ACT : Publish /8266-5/status,8266-5_Going_to_Sleep SLEEP: Powering down to deepsleep...

uzi18 commented 6 years ago

Ok I assume you did test with my changes?

rene9900 commented 6 years ago

Ok I assume you did test with my changes?

i did try the changed ino file, but got the error i posted: 'thisBinaryMd5' was not declared in this scope

EDIT: the esp-12 works fine both on deepsleep manual awakening and timed. i managed to upload the mega esp to my -01 module since it was a black non 512kb unit, but that one will not sleep on either 0 sec or timed wakeup, the enable sleep gets saved but nothing appers in logfile about enabling sleep.

uzi18 commented 6 years ago

@rene9900 just buy 32Mbit flash and solder it on esp board.

rene9900 commented 6 years ago

I tested on a wemos mini, the deepsleep 0 which worked on R120 on both wemos and -01 do not work unless a jumper cable connected reset to gpio16, any suggestions? Since my solder skills is too weak to solder a wire to reset -> gpio16 on the -01

TD-er commented 6 years ago

Like this you mean?

uzi18 commented 6 years ago

It is not so difficult as it is on the corner :) Try to use thin kynar wire it will be more easy.

rene9900 commented 6 years ago

ike this you mean?

yes, like that...i cust cant figure out what the difference is from R120 to the Mega firmware that makes it change so it is needed to solder that wire to GPIO16, i can use deepsleep in the obsolete firmware version with no wire at all?

TD-er commented 6 years ago

If you can do that without soldering, I am also quite curious how it should be done.

I thought I read somewhere someone made a comment about that, including how to do it, but I couldn't find it yesterday. Not sure if it was here, or on the forum.