Closed houser42 closed 2 years ago
Hm I just send that flag to the shelly … I will try to reproduce it.
Hm I just send that flag to the shelly … I will try to reproduce it.
Great, thanks @windkh I look forward to your reply. Let me know if I can test something. Many thanks!
@houser42 it works in both directions on --> off after 2s and off --> on after 2s
I tested it using this flow
[{"id":"7899c86207400f26","type":"debug","z":"f45ce90b3151803b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":440,"wires":[]},{"id":"9d972196920e1ce5","type":"function","z":"f45ce90b3151803b","name":"0 on","func":"msg.payload = {\n id : 0,\n on : true,\n toggle_after : 2 // optional flip back time in seconds\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":440,"wires":[["2c6bffe0d8827f5f"]]},{"id":"3b2db8394dc6ea85","type":"function","z":"f45ce90b3151803b","name":"0 off","func":"msg.payload = {\n id : 0, \n on : false,\n toggle_after : 2 // optional flip back time in seconds\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":500,"wires":[["2c6bffe0d8827f5f"]]},{"id":"72b2ecfbb65b923b","type":"inject","z":"f45ce90b3151803b","name":"Turn On","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":204.99413108825684,"y":440.193359375,"wires":[["9d972196920e1ce5"]]},{"id":"2972b780145b01f1","type":"inject","z":"f45ce90b3151803b","name":"Turn Off","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":500,"wires":[["3b2db8394dc6ea85"]]},{"id":"5aa54bfb2f16f55c","type":"inject","z":"f45ce90b3151803b","name":"Poll Status","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":380,"wires":[["2c6bffe0d8827f5f"]]},{"id":"2fdb598c3a9f0e8e","type":"function","z":"f45ce90b3151803b","name":"0 toggle","func":"msg.payload = {\n id : 0, \n method: \"Switch.Toggle\"\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":560,"wires":[["2c6bffe0d8827f5f"]]},{"id":"1597a10879f722a3","type":"inject","z":"f45ce90b3151803b","name":"Toggle","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":560,"wires":[["2fdb598c3a9f0e8e"]]},{"id":"2c6bffe0d8827f5f","type":"shelly-gen2","z":"f45ce90b3151803b","hostname":"192.168.178.242","description":"","pollinginterval":5000,"pollstatus":false,"getstatusoncommand":true,"devicetype":"Relay","outputs":1,"x":530,"y":440,"wires":[["7899c86207400f26"]]}]
@houser42 did you check if the latest firmware is used. What version of the nodes do you use?
Hello @windkh As mentioned, I have the latest versions of either. 7.1.0 of the node and 0.10.0 of the (Gen2)Shelly 1 PM plus relay.
I tried to test your flow but it its giving me an error when attempting to import into Node Red. "SyntaxError: JSON Parse error: Expected '} I am unable to figure out how to fix the formatting. Would love to test it!
This is what JSON formatter gives:
Error: Parse error on line 104: ... : 0, \n method: " Switch.Toggle "\n};\ ----------------------^ Expecting 'EOF', '}', ':', ',', ']', got 'undefined'
Thanks @windkh Yes, that works here also. Many thanks! Must have been something wrong with the flow I used. May I also ask if it is possible to use flip back on and flip back off after x secs. rather than toggle with this node? As you can withMQTT. If so what is the suggested payload? There is no example here that I can see? Many thanks again.
I believe I found the issue that confused me: The Shelly 1 PM Plus in case had an auto-on timer set. I would assume this is intended behaviour that you can not override the auto on timer with a toggle back command via this command on your node or via a MQTT auto on either? Many thanks for your kind support regardless!
@houser42 hm… to be honest I do not know how the API calls interfere with MQTT as I never used it in both ways at the same time
Thanks again @windkh I would also prefer to only use your node.. The only thing missing for my purposes is the ability to be able to override an auto on set on the relay with a temporary one called in a payload for something like a reboot. I hope that makes sense. The shelly API is very decent but a little confusing at times. That is why your node is very attractive to me at least. Many thanks again.
I am not sure if got your point. What do you mean with "auto on set" ??? The setting that controls how the switch should be set when powering up??? on, off, last mode?
Yes, @windkh sorry for being unclear. I specifically mean the auto on after switching off. I am using the shelly relays in a purely off-grid scenario to save power via automations. I would like to be able to do a remote 10 sec. reboot of one Shelly 1 PM plus that also has an "auto on in 8 hours" setting for security purposes. A bit esoteric perhaps, but that is why I am here ;)
can you send me the json that is returned for http://yours-witch-ip-here/settings Just to see how you configured your shelly
I am not at the remote site now, so not sure I can get that information for you unless I can get it from the node red install, as I have remote access to that. But there is nothing special with the Shelly 1PM Plus, apart from that it is, as I am sure you are aware a Gen 2 device. Standard MQTT setup and other than that the only thingI have changed is an 8 hour auto-on which means it will always switch on after 8 hours.
Hello, I just updated to your new 7.2.0 version that asI understand it, says it has support for changing the configuration via payloads to this node. Does this help with my issues by any chance? The docs do not reflect this at this time, which is understandable. Just very curious? Many thanks!
Right now this is only implemented for gen1 devices…I will add support for gen2…soon
Great to hear! Thanks for your time and patience!
Just so I understand what the intended functionality is for this node in this regard?
Can we expect:
var newMsg = {"topic":"shellyplus1pm-xxxxxx/rpc","payload":{"id":123, "src":"user_1", "method":"Switch.Set", "params":{"id":0,"on":false, "auto_on": true, "auto_on_delay":5}}} return newMsg;
This switches of the Shelly, but does not come back on.
Grateful for a comment when you have a moment. Many thanks.I reworked the rpc protocol for shelly gen 2 switch. Please have a look at the new example for shelly plus in version 8.0.0
Yes, this appears to be a great improvement and works pretty much as at least I had expected.
In my tests I am using the new 8.0 version of your node and the standard new 0.10.1 firmware on a Shelly 1PM plus that was also new.
Now, when first setting a timer on the device itself, in my case 8 hours Sending the commands in your gen 2 example will override with a 2 sec toggle flip back on. This is great and is close to what I wanted. With the 0.10.1 firmware on the Shelly it I also reflected in the webgui.
I prefer the discrete auto on, as the toggle command might accidentally turn the device off if one is not careful. This also works as expected after updating the Shelly to 0.10.1
Many thanks for this. You're a star!
@houser42 glad that it works for you
Edit: One thing that could maybe be even better that is probably for the Shelly developers to look at rather than you: Should the webgui not be updated by the Set Config payloads?
As it is now it is a little confusing:
If we set the Auto On timer in the webgui, it will count down in the web gui regardless if the Shelly is switched off via the webgui or your node commands. like so:
However, if the Auto On timer in the webgui is not set, it will still behave exactly the same with the payloads sent to your node, , but the webgui will not say anything about what is going on. Not ideal. But workable. Many thanks!
Deleted by user
Hello,
Thanks for a very useful node! One issue I see is that the node appears to act in an unintended way when using the "toggle_after “ function in the node payload. I might be misunderstanding the intended functionality but here is an example:
If I want to set a Shelly 1PM plus relay to switch off and then switch back on after X secs (very important feature in my work) This is the code that this node red flow example suggest we use:
This will indeed switch the relay off, as indicated but will not switch it back on after 2 secs. If I however send the payload again when the relay is off, it will switch back on. This seems wrong but please let me know if I am misunderstanding something or if this is a a bug? The Shelly 1pM plus I am testing with has firmware 0.10.0 and the node is 7.1.0 Many thanks.