HASS-sonoff-ewelink icon indicating copy to clipboard operation
HASS-sonoff-ewelink copied to clipboard

Issue with King M4 Dimmer

Open neil2048 opened this issue 5 years ago • 12 comments

Hi

I have noted a few previous posts about the King M4 Dimmer switch, but alot of them posts went on on tangents.

I have one of the these dimmers, it in is HASS and working as a on/off switch only, how can i get this listed as a dimmer in Hass.

From the eWelink App, its running the latest firmware 2.7.0, and ewelink has a slider for the brightness. it works perfectly from the app, i would like to be able to get the slider functionality into Hass too.

From previous posts i have noted that you need the export from sonoff-debug.py, so here is mine, what else do you need from me?

{ "__v": 0, "_id": "[hidden]", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "brandLogoUrl": "", "brandName": "KingArt", "createdAt": "xxxx-xx-xxxxx:xx:xx.xxx", "devConfig": {}, "devGroups": [], "deviceStatus": "", "deviceUrl": "", "deviceid": "[hidden]", "devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "extra": { "_id": "[hidden]", "extra": { "apmac": "xx:xx:xx:xx:xx:xx", "brandId": "59ba53ad86b3ab5e3ae68596", "description": "20181119004", "mac": "xx:xx:xx:xx:xx:xx", "manufacturer": "\u6df1\u5733\u5e02\u5f6a\u738b\u79d1\u6280\u6709\u9650\u516c\u53f8", "model": "PSF-BTA-GL", "modelInfo": "5b1642ec957beabc3b65e29a", "staMac": "xx:xx:xx:xx:xx:xx", "ui": "\u5355\u8def\u8c03\u5149\u5f00\u5173", "uiid": 36 } }, "group": "", "groups": [], "ip": "[hidden]", "location": "", "name": "[hidden]",, "offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx", "online": true, "onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx", "params": { "bright": 28, "fwVersion": "2.7.0", "partnerApikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "rssi": -62, "sledOnline": "on", "staMac": "xx:xx:xx:xx:xx:xx", "switch": "on" }, "productModel": "KING-M4", "settings": { "alarmNotify": 1, "appDoorbellNotify": 1, "opsHistory": 1, "opsNotify": 0, "wxAlarmNotify": 0, "wxDoorbellNotify": 0, "wxOpsNotify": 0 }, "sharedTo": [ { "note": "", "permit": 15, "phoneNumber": "[hidden]",, "shareTime": 1571677420436 } ], "showBrand": true, "type": "10", "uiid": 36 }

Regards

Neil

neil2048 avatar Nov 11 '19 22:11 neil2048

hi @neil2048 isn't this the same device as mentioned here https://github.com/peterbuga/HASS-sonoff-ewelink/issues/37? (it kinda does look the same to me)

peterbuga avatar Nov 12 '19 10:11 peterbuga

Hi @peterbuga

Yes it does look similar, do you need any other information to help get this supported correctly? As that thread was last updated in august.

Thanks again

Neil

neil2048 avatar Nov 12 '19 22:11 neil2048

@neil2048 not much hype was for this device and i kinda left it aside (giving the fact that i cannot test it myself) + the fact that in summer days i'm less likely to code for fun 😅

i'll consider this device too on the next batch of changes that i'm planning (if you can stick around to test it and report if it's working or not)

peterbuga avatar Nov 13 '19 08:11 peterbuga

Sure, just shout when you need me to test

neil2048 avatar Nov 13 '19 13:11 neil2048

Another tester here too - would really like to see this working!

Slight difference, firmware 2.9.1 on mine.

ianfretwell avatar Dec 04 '19 16:12 ianfretwell

new 2.txt Hello, need any other debug files? In app says King M4, fw 2.9.1 Found in Hass like a simple switch, no dimmer functions.

dmutpuul avatar Jan 29 '20 19:01 dmutpuul

Found in Hass like a simple switch, no dimmer functions.

it's normal, i did not implement the dimmer function yet. no ETA tho'

peterbuga avatar Jan 30 '20 10:01 peterbuga

Thanks for your solution) I saw another test branch, in light.py there is no dimmer function too?

dmutpuul avatar Jan 30 '20 15:01 dmutpuul

Maybe this would help. Debug info from dimmer operated via google assistant. Sonoff_debug_dimmerM4_GoogleAssistant.txt P.S. debug after logoff in ewelink app, then start debug and login , after that make some taps on dimmer... debug_logoff_ewelinkapp_then _logon.txt

dmutpuul avatar Jan 31 '20 16:01 dmutpuul

@dmutpuul thanks for the debug files, i have enough information for this to make it work. long story short: i could make it work fast - and continue increasing the level of spaghetti code (because itead maintains no schema consistency between devices) OR i want to rewrite it so that it's sanely & easier for me to add/maintain new devices .... i'm choosing the latter 😬

peterbuga avatar Feb 01 '20 12:02 peterbuga

Hello again. Sorry for spamming to this branch. How i understand main problem is to identify each device from ewelink. But what if we shall manually add every device by its unical id (from ewelink app). Something like if uid=1111111 then device is lamp or switch etc. Every id user can take from app, then add device manually to lamp.py or switch.py . It is just idea, i am noob in coding. So thank you @peterbuga for your regard.

dmutpuul avatar Feb 02 '20 07:02 dmutpuul

@dmutpuul cannot be done like this, or if i do i'll easily have other problems

peterbuga avatar Feb 02 '20 17:02 peterbuga