feat(place): event scrape#118
Conversation
easier to track when debugging and configuring
Co-authored-by: Philip Kheav <philip.kheav@hotmail.com>
This reverts commit 417573a.
This reverts commit 0d5cbf0.
* feat(place area count): initial work * feat(place area count): point check working * feat: current progress on area counting * initial work on S2 cells * feat(area management): complete area management grabs location data count how many devices in an area provide a summary of the building
also fixes `check_ownership_of`
to `device_locations` function
* feat(samsung): initial commit * fix(samsung): cleanup formatting and move to displays folder * feat(samsung): port over more methods * fix(samsung): update to pass driver test runner * feat(samsung): port over power function * feat(samsung): port over volume methods * fix(samsung): force compiler to process type for previous_volume as Int32 * feat(samsung): port over more methods * feat(samsung): port over more methods * fix(samsung): use enum to store constant values for commands * fix(samsung): cleanup types * chore(samsung): cleanup todos * fix(samsung): initialise @blank as nil * fix(samsung): add spec tests * fix(samsung): use safe getter to get self values * fix(samsung): use type safe getters when trying to access self values everywhere * fix(samsung): fix all warnings when running with spec * fix(samsung): commit correct file * fix(samsung): add check for sending of data from connected method in spec * fix(samsung): fix abstract tokenizer and add responses in spec * feat(samsung): add skeleton and checksum verification for received method * feat(samsung): complete most of the received method * fix(samsung): use task signals * feat(samsung): port over split function * feat(samsung): add status value checks to spec * fix(samsung): save screen_split value * feat(samsung): add macro to define methods * refactor(samsung): use Crystal's Bytes * chore(samsung): cleanup do_send param types * chore(samsung): remove documentation links * refactor(samsung): rename to MDCProtocol * refactor(samsung): use Enum's from_value instead of new * refactor(samsung): use question methods for Enums * refactor(samsung): update do_send to only take in COMMAND enums * refactor(samsung): use less intermediate arrays in do_send * chore(samsung): fix indentation * chore(samsung): remove custom command method * refactor/fix(samsung): move command assembly into enum class and use correct method to calculate checksum * refactor(samsung): more Bytes * chore(samsung): remove set timer method * chore(samsung): use camelcase convention for type names * chore(samsung) remove wake method * chore(samsung): remove ScaleModes enum and split method * fix(samsung): use panel mute command for mute * fix(mdc_protocol): use Powerable interface * fix(mdc_protocol): use Muteable interface * fix(mdc_protocol): implement Switchable interface * fix(mdc_protocol): initiliase previous volume * fix(mdc_protocol): use setting? instead of setting * feat(samsung): add Security annotation to methods * refactor(mdc_protocol): remove init_tokenizer method * refactor(mdc_protocol): use instance variables * fix(mdc_protocol): use immediate flag for scheduler * fix(mdc_protocol): let compiler infer type * fix(mdc_protocol): let compiler infer broadcast type * fix(mdc_protocol): define array for method names inline with macro * feat(mdc_protocol): add logic for message indicator * chore(mdc): remove completed todo * fix(mdc): define indicator as constant * fix(mdc): use indicator constant when building command Co-authored-by: Caspian Baska <caspianbaska@gmail.com> * chore(mdc): clean up do_device_config * fix(mdc): stringify setting names * fix(mdc): update require lines * fix(mdc): group device settings * chore(mdc): fix indentation * fix(mdc): return power after power query * chore(mdc): remove broadcast * fix(mdc): remove old ruby code * fix(mdc): set input target as nil initially * fix(mdc): set power properly * fix(mdc): create variable for hard_off * fix(mdc): assign variables when checking self values * fix(mdc): assign more self values to variables * chore(mdc): remove some logging * fix(mdc): use Muteable interface properly * fix(mdc): add spec for changing volume * fix(mdc): use correct hex value for spec * fix(mdc): use shorter way of checking self values * fix(mdc): use as_bool instead of as_bool? * fix(mdc): use strict parse instead of parse? Co-authored-by: Kim Burgess <kim@place.technology> * fix(mdc): correctly use commit github suggestion * fix(mdc): use if statement for checking MuteLayer * chore(mdc): use CamelCase * fix(samsung): address feedback * chore(mdc): use Input instead of Inputs * chore(mdc): use state instead of power * fix(mdc): change power_target to instance variable * fix(mdc): use shorter method to check MuteLayer * fix(mdc): remove unmute audio * fix(mdc): set input_target correctly * fix(mdc): don't use linebreak in error logging * fix(mdc): make check_power_state method private * fix(mdc): don't map response * fix(mdc): set type to UInt8 to reduce casting * feat(mdc): add specs for switch_to and power Co-authored-by: Philip Kheav <pkheav@Philips-MacBook-Pro.local> Co-authored-by: Caspian Baska <caspianbaska@gmail.com> Co-authored-by: Kim Burgess <kim@place.technology>
* feat(desk bookings): add desk bookings locations implementing location services so bookings can be highlighted on the map * feat(desk bookings): add spec
* fix(place/area/config): allow zone.metadata.area.properties.Hash
support
"areas": [
{
...
"properties": {
"label_location": {
"x": 0.5089,
"y": 0.6673
}
}
* this should fix it
Co-authored-by: Stephen von Takach <steve@place.tech>
| systems: {} of String => SystemWithEvents | ||
| } | ||
|
|
||
| now = Time.local |
There was a problem hiding this comment.
It's unlikely the the server TZ will be the same as the users TZ.
May be worth pulling a larger time slice, then filtering on front-ends, or support passing a timezone either to this method call, or applying as a setting for the driver instance.
| end_epoch = now.at_end_of_day.to_unix | ||
|
|
||
| @zone_ids.each do |z_id| | ||
| staff_api.systems(zone_id: z_id).get.as_a.each do |sys| |
There was a problem hiding this comment.
The #get here will block while each request completes, forcing them to run sequentially. It looks like these could happen safely concurrently.
It should be possible to reorganise this so that you map @zone_ids to an array of Futures (the staff_api.systems(..) call, then combine these into your response.
|
|
||
| response[:systems][sys_id] = SystemWithEvents.new( | ||
| name: sys["name"].as_s, | ||
| zones: Array(String).from_json(sys["zones"].to_json), |
There was a problem hiding this comment.
There's a roundtrip through some JSON serialisation here that doesn't look to be required.
| booking_module = staff_api.modules_from_system(sys_id).get.as_a.find { |mod| mod["name"] == "Bookings" } | ||
| # If the system has a booking module with bookings | ||
| if booking_module && (bookings = staff_api.get_module_state(booking_module["id"].as_s).get["bookings"]?) |
There was a problem hiding this comment.
You may need to expand the staff API driver to support this, but this can collapse into a single query via this endpoint:
Looks good to me testing on my local partner environment. Let me know if anything else should be changed or added @w-le @stakach
Also @stakach , might need your help figuring out why these methods
drivers/drivers/place/staff_api.cr
Lines 225 to 242 in 0e234bc
staff_api.cras they're more general than the working methods I added insteaddrivers/drivers/place/staff_api.cr
Lines 189 to 219 in 0e234bc
Oh yeah, tried writing a spec but couldn't get it working as it seems like the spec runner is a little bit flaky.