Open skarotech opened 2 weeks ago
If you can send me the json data for the device I might be able to extract that position information. My blinds don't report position so I've got nothing to review or test against.
here is the data
{"status":"VALID_TOKEN","data":{"name":"Bedroom L","type":"MS","location":"Master Bedroom","template":"RMS35","subtype":"ROLLERSHADE","tech":1,"actions":["Close","DecreasePosition","Hold","IncreasePosition","Open","Pair","PairAlt","SetPosition","Stop","ToggleOpen"],"":"cfd98228","_":"be3e0745","commands":{"":"c24bf15d"},"state":{"":"dacf0bcb"},"properties":{"":"9039d1d9"},"skeds":{"":"00000000"},"vrc":{"":"98ef2f4f"},"id":"94b0327cb35ab76e"}}
does not look like its reported via this http polling method, unless its hiding under the state value (which I can't see in their API)
However, it is returned if using the BPUP socket method, https://docs-local.appbond.com/#section/Bond-Push-UDP-Protocol-(BPUP)
then the data comes back like this, with the state and positioning {"Bridge":"10.11.11.100","Topic":"devices/4b48bcec7f77f3e1/state","Data":{"open":1,"position":0,"counter1":116,"counter2":0,"_":"64212043","__":"64212043"}}
does not look like its reported via this http polling method, unless its hiding under the state value (which I can't see in their API)
I think the state hash (ie the 'dacf0bcb') is updated if the state values change - so maybe adjust the blind and poll the json data for state information. The json data will update the state hash if the values in state change, in which case you are supposed to then make a call to .../devices/{device_id}/state to retrieve the changed values.
This is outlined here https://docs-local.appbond.com/#tag/Device-State
Let me know what you uncover.
looks like you are right, here is the testing results
OPEN {"name":"Spare Bedroom","type":"MS","location":"Guest Bedroom","template":"RMS35","subtype":"ROLLERSHADE","tech":1,"actions":["Close","DecreasePosition","Hold","IncreasePosition","Open","Pair","PairAlt","SetPosition","Stop","ToggleOpen"],"":"da6178d4","_":"961973d3","commands":{"":"f561215d"},"state":{"":"23e2ecb3"},"properties":{"":"d83fa02e"},"skeds":{"":"00000000"},"vrc":{"":"98ef2f4f"}}
CLOSED {"name":"Spare Bedroom","type":"MS","location":"Guest Bedroom","template":"RMS35","subtype":"ROLLERSHADE","tech":1,"actions":["Close","DecreasePosition","Hold","IncreasePosition","Open","Pair","PairAlt","SetPosition","Stop","ToggleOpen"],"":"2a1db928","_":"961973d3","commands":{"":"f561215d"},"state":{"":"edae7336"},"properties":{"":"d83fa02e"},"skeds":{"":"00000000"},"vrc":{"":"98ef2f4f"}}
36% {"name":"Spare Bedroom","type":"MS","location":"Guest Bedroom","template":"RMS35","subtype":"ROLLERSHADE","tech":1,"actions":["Close","DecreasePosition","Hold","IncreasePosition","Open","Pair","PairAlt","SetPosition","Stop","ToggleOpen"],"":"5782dfff","_":"961973d3","commands":{"":"f561215d"},"state":{"":"16282fad"},"properties":{"":"d83fa02e"},"skeds":{"":"00000000"},"vrc":{"":"98ef2f4f"}}
Okay, can you get me a dump of what the json returned is from that /state query would be ??
https://{your_bond_ip}/v2/devices/{device_id}/state
I just wish to be sure what I'm looking for because my blinds don't report the position
Ideally, you'd get me full open, fully closed and a partial like you have above for the state json
Open {"open":1,"position":0,"counter1":1484,"counter2":0,"_lock_priority":100,"_lockexpiration":0,"":"c710d818","__":"c710d818"}
Closed {"open":0,"position":100,"counter1":1488,"counter2":0,"_lock_priority":100,"_lockexpiration":0,"":"6a6d4fa4","__":"6a6d4fa4"}
Position (53% in Homey) {"open":1,"position":47,"counter1":1492,"counter2":0,"_lock_priority":100,"_lockexpiration":0,"":"07ed5574","__":"07ed5574"}
Cool. It will take me a while to refactor the main code to store and check the state hash, and when changed, also poll the state values, but end result should be that we can update the positioning values if present.
When running a close/open action, if the blind was previously at a position, it still shows this as its value,for example.
Can this be updated to read and reflect the correct position value after a command, or as part of the polling process ?