BrettSheleski / SmartThingsPublic

36 stars 23 forks source link

Added Case 0 to support Sonoff Mini #30

Closed loonass closed 4 years ago

loonass commented 4 years ago

Added Case 0 to line 202

BrettSheleski commented 4 years ago

I'll accept this. However I have a feeling that the module ID is not in fact 0, but it is failing the .toInt() conversion and defaulting to 0 as a result.

Could you verify the module ID returned by the device by invoking the appropriate command either by mqtt or http? I believe the command would be Status 0 but I'm not sure off the top of my head.

loonass commented 4 years ago

I agree it does seem suspicious. I'm really not a programmer though, I took it as being zero as that is what is reported in the parent DTH. It's also what is reported in the live logging in Smartthings IDE. I don't use MQTT and I wouldn't know how to send the command through HTTP.

This is the log though if it helps: 80f0abf9-91de-4ef7-bfc1-1b5841292343 15:35:15: debug JSON: [Status:[ButtonRetain:0, ButtonTopic:0, FriendlyName:[GarageLights], LedMask:FFFF, LedState:1, Module:0, Power:0, PowerOnState:3, PowerRetain:0, SaveData:1, SaveState:1, SensorRetain:0, SwitchMode:[0, 0, 0, 0, 0, 0, 0, 0], SwitchRetain:0, SwitchTopic:0, Topic:sonoff], StatusFWR:[Boot:7, BuildDateTime:2019-08-30T09:52:50, Core:2_5_2, SDK:2.2.1(cfd48f3), Version:6.6.0(sonoff)], StatusLOG:[LogHost:, LogPort:514, Resolution:558180C0, SSId:[Harvey2GHz, ], SerialLog:2, SetOption:[00008001, 280500000100060000000000000000000000, 80000000], SysLog:0, TelePeriod:300, WebLog:2], StatusMEM:[Features:[00000809, 0FDAE396, 001783A0, 22B617CD, 01003BC0], FlashChipId:144051, FlashMode:3, FlashSize:1024, Free:424, Heap:23, ProgramFlashSize:1024, ProgramSize:578], StatusNET:[DNSServer:8.8.8.8, Gateway:192.168.1.1, Hostname:GarageLights, IPAddress:192.168.1.114, Mac:2C:F4:32:A7:83:18, Subnetmask:255.255.255.0, Webserver:2, WifiConfig:4], StatusPRM:[Baudrate:115200, BootCount:19, CfgHolder:4617, GroupTopic:sonoffs, OtaUrl:http://thehackbox.org/tasmota/release/sonoff.bin, RestartReason:Power on, SaveAddress:F6000, SaveCount:102, Sleep:50, StartupUTC:2019-09-18T21:02:42, Uptime:1T17:32:32], StatusSNS:[Switch1:ON, Time:2019-09-20T15:35:15], StatusSTS:[Heap:22, LoadAvg:19, POWER:OFF, Sleep:50, SleepMode:Dynamic, Time:2019-09-20T15:35:15, Uptime:1T17:32:33, Wifi:[AP:1, BSSId:00:1D:AA:67:ED:C8, Channel:8, Downtime:0T00:07:50, LinkCount:129, RSSI:58, SSId:Harvey2GHz]], StatusTIM:[EndDST:Sun Oct 27 03:00:00 2019, Local:Fri Sep 20 15:35:15 2019, StartDST:Sun Mar 31 02:00:00 2019, Sunrise:06:33, Sunset:18:53, Timezone:+01:00, UTC:Fri Sep 20 14:35:15 2019]]

loonass commented 4 years ago

So I think I now understand what you mean. So I have gone to the IP address, clicked console on the Tasmota dashboard and typed status (Status0 works too). This is the result:

15:43:40 CMD: status 15:43:40 RSL: STATUS = {"Status":{"Module":0,"FriendlyName":["GarageLights"],"Topic":"sonoff","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}

loonass commented 4 years ago

OK, I'm learning. so I know why the module ID is 0. https://github.com/arendst/Sonoff-Tasmota/wiki/Modules There is no official support in Tasmota so I had to create my own template. This is why it reports 0

BrettSheleski commented 4 years ago

Makes sense why it's returning 0 then.

I may modify the code where the default case for an unknown module is to treat it like a Sonoff Basic and create a single Sonoff-Power child device. It's not exactly the same as as it is now, but it's darn close.