Skip to content

Add logic driver to sync Cisco Webex Nagivator LED color to Bookings status via xAPI. Untested#553

Merged
w-le merged 2 commits into
masterfrom
feat/xapi_led_bookings_sync
Apr 10, 2025
Merged

Add logic driver to sync Cisco Webex Nagivator LED color to Bookings status via xAPI. Untested#553
w-le merged 2 commits into
masterfrom
feat/xapi_led_bookings_sync

Conversation

@w-le
Copy link
Copy Markdown
Contributor

@w-le w-le commented Mar 31, 2025

todo:

  • DONE: compile without errors,
  • spec

@w-le w-le self-assigned this Mar 31, 2025
Comment thread drivers/cisco/booking_panel_led_sync.cr Outdated
end

def sync_led_color_now
return unless ["true", "false"].includes?(room_in_use = system[:Bookings][:in_use].as_bool)
Copy link
Copy Markdown
Contributor Author

@w-le w-le Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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])

Copy link
Copy Markdown
Member

@stakach stakach Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks guys!

@w-le
Copy link
Copy Markdown
Contributor Author

w-le commented Apr 10, 2025

tested e2e working ok against live xAPI driver and Bookings module for the 2 main cases Bookings.in_use true/false

@w-le w-le requested review from chillfox and stakach April 10, 2025 05:16
@w-le w-le marked this pull request as ready for review April 10, 2025 09:00
@w-le w-le merged commit 7ea5a28 into master Apr 10, 2025
3 of 6 checks passed
@w-le
Copy link
Copy Markdown
Contributor Author

w-le commented Apr 10, 2025

merged for deployment. But I will keep this feat branch open for reviews of the specs that I will write later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants