Closed ghost closed 1 year ago
Hello, For example, you can use the response_all dictionary to retrieve the on/off values for each channel.
...
"digest": {
"togglex": [
{
"channel": 0,
"onoff": 1,
"lmTime": 1662868286
},
{
"channel": 1,
"onoff": 0,
"lmTime": 1669506095
},
{
"channel": 2,
"onoff": 0,
"lmTime": 1668543897
},
...
],
"triggerx": [],
"timerx": []
}
...
Hi!
To gather information about the switch status on a MSS310, you can simply use the is_on()
method. That's documented here.
Just be advised: before querying for internal device state, you should always invoke the async_update()
to fetch initial info.
In other words, something like this should do the trick:
async def main():
# Initate the manager, login, etc...
# manager = ....
# Gather the device you'd like to fetch info from
# await manager.async_device_discovery()
# dev = manager.find_devices(uuid="YOURUUUIDHERE")
# Fetch the device data
await dev.async_update()
# Check if that's on or off
is_on = dev.is_on(channel=0) # MSS310 only has 1 channel
@ketchu13: thanks, that worked for me
I have written a monitoring task to switch on/off mss310 devices based on a number of conditions.
On startup of the task I would like to get the initial state (on/off) of the switches but can only query the online-status and not the switch status?