Closed shanelilley closed 2 years ago
hiya, which device types in particular are you looking to query with the api? im kinda implementing things on a request basis!
Hey! So require -
Please update to the beta version, I have implemented get state for these device types, controlling will hopefully come tomorrow!
Awesome! Just tested, switches and lights look good! Simulations for irrigation valves and the Echeon roller door and the contact sensors are the other ones I really need if that is at all possible?
Should be working for the devices you have mentioned too, did you update to the beta?
Irrigation valve (single relay as a valve) -
Back garden main solenoid 100134c534SWX {'name': 'Back garden main solenoid', 'hbdeviceid': '100134c534SWX', 'status': {'wan': True, 'lan': True, 'ip': '192.168.201.140'}}
Query directly on the device itself -
100134c534SWX {'success': False, 'error': 'accessory.control.currentState is not a function.'}
Yep beta running with all prerequistes... I can actually see now lights, switches, temperature, contact sensors.
Ah, I see you list "garage" as a service type, so the Echeon simulation works perfectly. What I cannot see is the irrigation valve type.
So last thing I notice is that we get a weird return on the json for "power" devices - we get 'power' and 'switch' as services and the actual switch state which is good. However the 'power' state gives a very long number, not sure if its encoded?
Hoping to be able to get the current kw power reading from the device.
Device Name: POWR3Device37b934 {'success': True, 'response': {'status': {'wan': True, 'lan': True, 'ip': '192.168.201.162'}, 'services': ['switch', 'power'], 'switch': {'state': 'on'}, 'power': {'state': '010805040304030405030100030100030205030304030009030104030303030504030404030606030800040101040301040601030506030602030305030306030409030806030600030408030302030208030307030306030500030607030206030203030106030101030008030400030605030103030007030000020902020803030101040408030305030101020907030001020906030102030308030107030005030005030107040506040104030701030200020908020408020307020808030105020707020803030000030306030100020906020901030404020808020801030501030405020601020605020802020803020903030300030004020407010804020408010505010701020407020002020707010903030506010902010700020004030200020604030308'}}}
Kind regards, Shane
Please check the latest beta, you should also see current power, current and voltage via the API. These long numbers are usage history for the last 100 days, I will find a reference to how to decode it, it's in a closed issue on here somewhere!
oh brilliant! Makes sense. Installed and testing....
which irrigation simulation do you use? I thought you used the 'switch + valve' one?
So I take a Sonoff basic/mini/RF/SV as per the GUI for single and double channel devices as show as a single or double irrigation valve. Is that what you mean? Cheers, Shane
This is the response I get back when I query a switch/solenoid directly -
Device Name: Back garden main solenoid {'success': False, 'error': 'accessory.control.currentState is not a function.'}
Hope this helps! Kind regards, Shane
is this for your valve? i haven’t implemented for valve yet, i thought you used the “valve + switch” simulation 😆
i will get to it
Can you try 8.11.3-beta.4?
Can do! installing now :-)
Ok - so I can see "valve" and looking good with state. Very cool!
This issue has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@shanelilley ive gotten a bit lost is there anything else you need from the api?
@bwp91 - yep been testing on .12 and all looks really awesome. Definitely time to close this one off and again awesome work and many thanks! The API method is just so much better and rock solid. Shane.
Hey! API is great, love it... Using it to push status etc out to MQTT. But I've noticed I cannot obtain info such as a door sensor 'state' . Return from direct deviceID query is "'accessory.control.currentState is not a function.'"
I notice even if I dig in to the return object/json there is no "state" of any kind (open/closed/tripped).
Do I need to perhaps query ewelink directly?
Cheers! Shane