Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Sensor
- def initialize(ip_address:, api_key:)
- # Set up our connection to the sensor so we can easily make requests to it later
- end
- def booking_has_presence(start_time, end_time)
- # Every x amount of time, check if presence is true
- Thread.new do
- ::Libuv::Reactor.new.run do |reactor|
- reactor.scheduler.at(start_time) do
- reactor.scheduler.every('2m') do
- this.has_presence()
- end
- end
- end
- end
- def has_presence
- # Return true when detected and false when not
- end
- def current_booking(bookings)
- end
- def get_bookings
- # Get a list of bookings
- end
- # This function will be replaced by a scheduled call
- def start
- # Get our bookings
- bookings = get_bookings
- # Check what's on now
- booking = current_booking(bookings)
- # Just output if booking has usage for now
- puts
- end
- end
Add Comment
Please, Sign In to add comment