windkh / node-red-contrib-shelly

Shelly control nodes for node red.
MIT License
34 stars 21 forks source link

Adding support for SNPL 00116US #78

Closed Jacksonbm1 closed 2 years ago

Jacksonbm1 commented 2 years ago

I have a Gen 2 Shelly US plug. I am using your integration and ma able to turn on and off the plug, but I"m getting the Shelly type mismatch: SNPL-00116US. If you want, I'm happy to help debug this to add it to official integration – it just might take a bit of time.

Also, as an aside, do you know how to suppress those errors?

windkh commented 2 years ago

Hi if the device is compatible with the others which are already supported, then it should be not a big deal. I could adapt the code and then it would be great if you could test if it works...

Jacksonbm1 commented 2 years ago

Sure. Just let me know what tests you want and how to run them

windkh commented 2 years ago

hi @Jacksonbm1 Well I am a bit confused as you wrote "Gen 2". Are you sure that this device is a 2nd generation device which supports the new gen 2 api, or is it just similar to the shelly plug s which you can buy here in Europe

Shelly Plug US https://shopusa.shelly.cloud/shelly-plug-us-wifi-smart-home-automation#393

Shelly Plug S https://shop.shelly.cloud/shelly-plug-s-wifi-smart-home-automation#62

Well, if both devices are internally the same, then it should be a gen 1 device.

On the other hand all older device start with SH... and all newer ones with SN or SP for the pro version. So it could be that it is just a gen 2 relay.

Please provide more details so that I know what node to change for you....

windkh commented 2 years ago

Can you send me the response of the shelly in your browser "http://your-shelly's-ipaddress-here/shelly"

The output of a gen2 device should look like

image

Jacksonbm1 commented 2 years ago
  1. Ok, working on getting you the information:

Re: gen 1 vs 2. I was going off what I was told in the following two posts:

Maybe it's gen 2 in a different sense than you're talking about?

  1. Results:
    {"name":null,"id":"shellyplugus-083af201c4d8","mac":"083AF201C4D8","model":"SNPL-00116US","gen":2,"fw_id":"20220211-132652/plugusprod2_app-gcb4621f","ver":"plugusprod2","app":"PlugUS","auth_en":false,"auth_domain":null}

Hope that helps!

windkh commented 2 years ago

@Jacksonbm1 yes that helped. Indeed it is a gen 2 device. So it should be compatible with the Shelly Plus. 99-shelly.zip

Can you unzip the file and replace the file 99-shelly.js in the folder where you installed the nodes? under windows this should be C:\Users\%USERNAME%.node-red\node_modules\node-red-contrib-shelly\shelly...

Then take a gen 2 node and configure it as "Relay".

If that test works, then I will finalize the work and create a new release. Thanks in advance.

Jacksonbm1 commented 2 years ago

Got it! It worked except that it seems like the on off buttons are reversed (I just grabbed the example code and added my rules).

So turn on will turn it off and vice versa.

Code:

[{"id":"2a0d4cf.cf9e6b4","type":"shelly-gen2","z":"617941e5.1c25","hostname":"192.168.86.37","description":"ap shelly post 2","mode":"polling","server":"","outputmode":"event","uploadretryinterval":5000,"pollinginterval":5000,"pollstatus":false,"getstatusoncommand":true,"devicetype":"Relay","outputs":1,"x":1160,"y":2300,"wires":[["fd13a665.b18848"]]},{"id":"943b269e.dbdfa8","type":"inject","z":"617941e5.1c25","name":"Get Status","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":780,"y":2260,"wires":[["2a0d4cf.cf9e6b4"]]},{"id":"8936c9ba.18f9f8","type":"function","z":"617941e5.1c25","name":"0 on","func":"msg.payload = {\n    method: \"Switch.Set\",\n    parameters : {\n        id : 0,\n        on : true,\n        toggle_after : 2 // optional flip back time in seconds\n    }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":2320,"wires":[["2a0d4cf.cf9e6b4"]]},{"id":"a8be884f.f48af8","type":"function","z":"617941e5.1c25","name":"0 off","func":"msg.payload = {\n    method: \"Switch.Set\",\n    parameters : {\n        id : 0,\n        on : false,\n        toggle_after : 2 // optional flip back time in seconds\n    }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":2380,"wires":[["2a0d4cf.cf9e6b4"]]},{"id":"8a26ef73.9e32f","type":"function","z":"617941e5.1c25","name":"0 toggle","func":"msg.payload = {\n    method: \"Switch.Toggle\",\n    parameters : {\n        id : 0,\n    }\n};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":2440,"wires":[["2a0d4cf.cf9e6b4"]]},{"id":"adae31ae.d9655","type":"function","z":"617941e5.1c25","name":"id 0","func":"msg.payload = {\n    method: \"Switch.GetConfig\",\n    parameters : {\n        id : 0,\n    }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":2500,"wires":[["2a0d4cf.cf9e6b4"]]},{"id":"8d3674ea.09ee58","type":"function","z":"617941e5.1c25","name":"id 0","func":"msg.payload = {\n    method: \"Switch.SetConfig\",\n    parameters : {\n        id : 0,\n        config : {\n            // name : \"switch\",\n            // in_mode : \"follow\",\n            // initial_state : \"restore_last\",\n            auto_on : true,\n            // auto_on_delay : 60.00,\n            // auto_off : false,\n            // auto_off_delay : 60.00,\n            // power_limit : 3500\n        }\n    }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":2540,"wires":[["2a0d4cf.cf9e6b4"]]},{"id":"fd13a665.b18848","type":"debug","z":"617941e5.1c25","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1330,"y":2320,"wires":[]},{"id":"7c8ababa.894c84","type":"inject","z":"617941e5.1c25","name":"Turn On","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":784.9941310882568,"y":2320.193359375,"wires":[["8936c9ba.18f9f8"]]},{"id":"a789fce7.d3be2","type":"inject","z":"617941e5.1c25","name":"Turn Off","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":780,"y":2380,"wires":[["a8be884f.f48af8"]]},{"id":"617f8aff.6318e4","type":"inject","z":"617941e5.1c25","name":"Toggle","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":770,"y":2440,"wires":[["8a26ef73.9e32f"]]},{"id":"5453abc5.8b49c4","type":"inject","z":"617941e5.1c25","name":"Get Config","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":780,"y":2500,"wires":[["adae31ae.d9655"]]},{"id":"b9520ec0.b628e","type":"inject","z":"617941e5.1c25","name":"Set Config","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":780,"y":2540,"wires":[["8d3674ea.09ee58"]]}]
Jacksonbm1 commented 2 years ago

Just wanted to drop by and check in on how this issue is doing. No rush, just pretty sure everything is 99% working (except the above mentioned problem.

windkh commented 2 years ago

Will do this at the weekend...

windkh commented 2 years ago

@Jacksonbm1 I can not find out why your SNPL does not behave like the other shellies. Can you please check via http://192.168.86.37 if there is a setting that could be responsible for that. See the menu for the Shelly 1 PM: Reverse Input

image

windkh commented 2 years ago

@Jacksonbm1 In the shelly 1 PM configuration menue I can invert the channels:

image

Jacksonbm1 commented 2 years ago

Doesn't seem like I have that option:

image

I also have a ticket with shelly that I need to respond to. They want me to try to check the firmware by connecting to a hotspot (not sure why), but I'm a little loathed to do it since I'd need to rebuild an already semi-working system