windkh / node-red-contrib-shelly

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

Gen3 Devices #151

Closed impact0815 closed 5 months ago

impact0815 commented 6 months ago

Hi, please add the new Gen 3 devices:

Gen3 Device Types: S3PM: Shelly PM Mini Gen3 https://kb.shelly.cloud/knowledge-base/shelly-pm-mini-gen3 S3SW: Shelly 1(PM) Mini Gen3 https://kb.shelly.cloud/knowledge-base/shelly-1pm-mini-gen3

(don't forget to add the node.shellyInfo.gen === 3 check.) Haven't tested differences in APIs between gen 2 and 3 yet. As the docu is hirarchically beneath the gen2, my hope is that there is not much to change, see: https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen3/ShellyMini1G3

I have a S3PM and can test if needed, with my changes this is the current output: {"status":{"ble":{},"cloud":{"connected":true},"mqtt":{"connected":true},"pm1:0":{"id":0,"voltage":231,"current":0.184,"apower":3.9,"freq":50,"aenergy":{"total":27.185,"by_minute":[0,211.286,0],"minute_ts":1711990980},"ret_aenergy":{"total":0,"by_minute":[0,0,0],"minute_ts":1711990980}},"sys":{"mac":"ABC123ABC123","restart_required":false,"time":"19:03","unixtime":1711991028,"uptime":25205,"ram_size":260344,"ram_free":87264,"fs_size":1048576,"fs_free":724992,"cfg_rev":14,"kvs_rev":7,"schedule_rev":1,"webhook_rev":0,"available_updates":{},"reset_reason":3},"wifi":{"sta_ip":"192.168.1.4","status":"got ip","ssid":"ssid","rssi":-63},"ws":{"connected":false}},"payload":{"pm10":{"id":0,"voltage":231,"current":0.184,"apower":3.9,"freq":50,"aenergy":{"total":27.185,"by_minute":[0,211.286,0],"minute_ts":1711990980},"ret_aenergy":{"total":0,"by_minute":[0,0,0],"minute_ts":1711990980}}},"_msgid":"a88452f26b8ae712"}

windkh commented 6 months ago

I added some gen 3 devices already but I treat them like gen 2 ones. Please send me the response of your shelly for the /shelly route.

impact0815 commented 6 months ago

What exactly do you need? I don't understand "/shelly route". A typical value set for a Mini PM Gen3 is in the initial post. In the current version there is no check for "node.shellyInfo.gen === 3" which (next to the missing DevTypes) blocks the use of the Gen3 as a Gen2.

windkh commented 6 months ago

Http://ipofyourshellyhere/shelly

I need the type of it

impact0815 commented 6 months ago

as gen2 the gen3 use "model" instead of type { "name": "ShellyPMMiniG3", "id": "shellypmminig3-123456", "mac": "ABC123ABC123", "slot": 0, "model": "S3PM-0010000", "gen": 3, "fw_id": "20240223-141904/1.2.2-g7c39781", "ver": "1.2.2", "app": "MiniPMG3", "auth_en": false, "auth_domain": null }

// for my testing I added

} // Generation 2 devices else if(node.shellyInfo.model && node.shellyInfo.gen === 2){ deviceType = node.shellyInfo.model; requiredNodeType = 'shelly-gen2'; } // Generation 3 devices else if(node.shellyInfo.model && node.shellyInfo.gen === 3){ deviceType = node.shellyInfo.model; requiredNodeType = 'shelly-gen2'; } else {

===========
And let gen2DeviceTypes = new Map([
["Relay", ["SHSW-", "SNSW-", "SPSW-", "SNPL-", "SNPM-", "S3PM-"]],

=== The model identifier are on the description page https://kb.shelly.cloud/knowledge-base/shelly-pm-mini-gen3 => S3PM Therefor the 1PMMini probably has S3SW, I have only Gen2 PMMini at hand.

windkh commented 6 months ago

Thanks for the hint. Will do the changes when I am back from vacation

windkh commented 5 months ago

@impact0815 I checked the changes you suggested... and most of it was already implemented. I will release a new version 10.22.0 maybe you can do some testing with that version?