-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Energy monitoring template & PowerOnState #5594
Comments
That could be a template issue which you will have to debug and correct yourself |
The template works perfectly and does not have any issues as long as power is not lost to the device The problem is when PowerOnState is set to the defaul of 3, the device is on and it lost power then power returns. It has no problem when PowerOnState is 0. Apparently tasmota is not setting the state of the light to the same as the relay during the power on. I will investigate the template but I hope someone with knowage of tasmota will look into what I said above. @blakadder you appear to be the owner of the templates on GitHub. I tried to put the below note on the template description but I don't have permission. Please put something like the following note on the template page. Thanks. "Their is an issue when using this template with tasmota 6.5.0. See issue 5594 for additional information." |
Hi, I could not reproduce your issue. Please, could you be so kind on completing the troubleshooting template in order to have more information so as to properly help you? Also, please, add the console output at Tasmota starts. Remember to put the weblog to 4 before that. Remember to read the Contributing Guideline and Policy. Thanks. Support Information (Guide)See Wiki for more information. |
BUG DESCRIPTIONI installed tasmota 6.5.0 on an AWP04L energy monitoring plug. I then installed the template for this plug from https://blakadder.github.io/templates/awp04l.html {"NAME":"AWP04L","GPIO":[57,255,255,131,255,134,0,0,21,17,132,56,255],"FLAG":0,"BASE":18} All worked including the energy monitoring. However when power is removed then restored from/to the device, the relay remains on (supplying power to the load) but the website and the power light indicate off. Pressing the button corrects the state indicated by the light and website. REQUESTED INFORMATION
(Please use
TO REPRODUCESteps to reproduce the behavior:
The load had power after step 5 as it should. However the device indicates otherwise. EXPECTED BEHAVIOURA clear and concise description of what you expected to happen. SCREENSHOTSIf applicable, add screenshots to help explain your problem. ADDITIONAL CONTEXTAdd any other context about the problem here. |
Hi, Thanks for completing the template and sharing the requested information. Very appreciated. After the device boots, if you refresh the web page, it still shows OFF while the relay is ON? |
Thank you for looking into this. Yes, it still shows OFF while the relay is ON after I refresh the web page. Pressing the device button or TOGGLE on the web page puts the device's light and web page indicating ON state while the relay remain that. Basically the device always indicate OFF when it powers up regardless of its state when the device lost power. |
Let's try a test. Please, could you go to extra configuration menu and disable mqtt? Then please try again to toggle to ON, remove power and power it again. |
Samething. The relay is on but the device light and website indicates off. Below is console after I reapply power.
|
I am able to reproduce bug #5663
After restart, the relay, and light are on (should be off). Power monitoring is also active. The above is regardless of mqtt being enabled or not. However, with PowerOnState = 0, the device now operates correctly when I remove power then restore power to the device. |
I will be happy to test both error conditions when a possible solution is found. |
Could you try changing your template from
to
This will change GPIO12 from "Relay1" to "Relay1i" inverting the relay. You might also have to play with GPIO0 (Led2i) and/or GPIO15 (Led1i). |
Thank you for your help. Unfortunately the relay is now opposite to the stated indicate by the device web page. |
OK. In that case set it back to Relay1 (21). |
Could you pls verify what the statetext are:
|
If equal pls change code in sonoff.ino line 2694 from:
in
|
Using command |
I am only able to download .bin files. I am unable to change the code. Sorry |
I also no longer compile my own code. Is SetOption63 (6.5.0.9) in the most recent thehackbox binaries? |
SetOption63 1 did not fix the problem. |
@BostonMikeGetHub your version does not contain the fix. It should be in Hackbox soon as commit e8e7b25 |
Mike, you need to OTA from http://thehackbox.org/tasmota/020300/ when the new binary is ready. |
So I can document it properly in the wiki, |
ON (1) disables scanning at restart (default is OFF (0)) |
I won't be available to verify the issue is resolved on my device until the weekend. |
Thank you Theo and everyone for your help. I got some time for testing. I found one case where their is still a problem.
My issue is resolved when PoweOnState is 3 for both lost then return of power and when restarting the device. When PoweOnState is 0 and the relay is on: The issue is resolved with lost then return of power. (Relay is off after power up) However, the relay remains on when restarting the device using its web site. To me, it is important the power on state is correct after lost then return of power. A power lost could be beyond the user knowage. But the user will be the one rebooting so they can easily correct the relay state. So I am satisfied and will close this bug upond Theo's or @ascillato2 request. Thank you again. |
Console of error case: poweronstate 0, Relay on, restart using web site.
|
This is a very old issue and currently as designed. Bottomline is that a restart is different from a power cycle. During a restart PowerOnState is NOT checked for the simple reason the relays are being set to the state before the restart. A restart is supposed to happen unexpectedly and should be virtually unnoticed for the relay state. In this case it's no different; PowerOnState is not being used when a restart is executed for the simple reason it's not a power On situation. This functionality was discussed at that time (see old issues). |
OK, now the obvious strikes! PowerOnState means exactly what it says - when power is turned on. Is not scanning the relay state on restart (i.e., |
Scanning the relay state has, in my eyes, always been a very strange piece of code... It was added to satisfy ElectroDragon users but what it does is reading from GPIO's configured as OUTPUT! The result, as you noticed will not always be what you expect as it all depends on how the relays are hardwired to the GPIO. To make this scan optional command SetOption63 was introduced. Tasmota keeps score of the relays state in a masked variable called "power". A 1 in a bit location always means a relay turned ON (depending on configured relay as relay1 or relay1i the GPIO is turned low or high). Every change in relay state is only executed after a change in "power". When "power" changes a copy is saved in flash. So after a restart "power" is reinitialised with the saved state from flash and the relay is set to the state that "power" is in. PowerOnState is not used in this case. |
If
If |
Nope. In both cases the relays are set as stored in "power". SetOption63 is executed AFTER PowerOnState or Restart init. The difference with SetOption63 is that when disabled (0) it will scan the relay GPIO's (outputs) and read it's state using "digitalRead". It will then update the "power" variable with it's detected values. No relay states will be changed. These values may be different from what there was before the relays were set. This solved the ElectroDragon issue but made your issue. Sonoff devices do not need this but were not affected by it's functionality. |
This may have done it... put it beyond my ability to comprehend 😉 So, with |
It should never do a scan. There is no valid way of getting input status from an output configured GPIO. What I tried to say is that for the ElectroDragon it worked. For many others it also worked and didn't change anything. It just doesn't work for your and Mike's device. There should be no need to run this piece of code. Weekend! |
TTFN. Thanks. |
Closing this issue as it is solved. Thanks everyone 👍 |
Thank you for fixing the bug, the explanation and for creating & maintaining tasmota. |
I installed tasmota 6.5.0 on an AWP04L energy monitoring plug. I then installed the template for this plug from https://blakadder.github.io/templates/awp04l.html
All worked including the energy monitoring. However when power is removed then restored, the relay remains on but the website and the power light indicate off. Pressing the button corrects the state indicated by the light and website.
PowerOnState = 3
Can this be fixed by tasmota or the template?
The text was updated successfully, but these errors were encountered: