Add logic driver to sync Cisco Webex Nagivator LED color to Bookings status via xAPI. Untested#553
Conversation
…status, via xAPI. Untested
| end | ||
|
|
||
| def sync_led_color_now | ||
| return unless ["true", "false"].includes?(room_in_use = system[:Bookings][:in_use].as_bool) |
There was a problem hiding this comment.
Driver Harness states that system[:Bookings][:in_use] is JSON::Any and errors with and without .as_bool
What's the best way to handle this to fetch the Bool value of another module's status?
I'm following the example at https://docs.placeos.com/tutorials/backend/write-a-driver#logic-drivers, which is given as:
# Look at status on a remote module
system[:Display][:power] #=> true
so was expecting system[:Bookings][:in_use] to return a Bool not JSON::Any
There was a problem hiding this comment.
What's the actual error you are getting?
You can try inserting these lines above it to get more details about what system[:Bookings][:in_use] actually contains.
pp! system[:Bookings][:in_use]
pp! system[:Bookings][:in_use] == nil
pp! typeof(system[:Bookings][:in_use])
There was a problem hiding this comment.
All status values are JSON::Any
The way to query when you know the type is:
system[:Bookings].status?(Bool, :in_use)
I would use status? in case the status hasn't been set yet.
I've also updated the docs
|
tested e2e working ok against live xAPI driver and Bookings module for the 2 main cases Bookings.in_use true/false |
|
merged for deployment. But I will keep this feat branch open for reviews of the specs that I will write later on. |
todo: