Module: Sense::Sensors
- Included in:
- Client
- Defined in:
- lib/hello_sense/sensors.rb
Instance Method Summary collapse
-
#sensors ⇒ Array<Hash>
Known types: *
TEMPERATURE*HUMIDITY*LIGHT*PARTICULATES*SOUND. -
#sensors_historical(hours:) ⇒ Hash
Historical sensor data, sampled every five minutes.
- #update_sensors(data) ⇒ Object
Instance Method Details
#sensors ⇒ Array<Hash>
Known types:
-
TEMPERATURE -
HUMIDITY -
LIGHT -
PARTICULATES -
SOUND
116 117 118 119 |
# File 'lib/hello_sense/sensors.rb', line 116 def sensors data = get('/v2/sensors') data['sensors'] end |
#sensors_historical(hours:) ⇒ Hash
Note:
Seems to top out at around 920 hours – higher numbers result in empty data; probably some timeout on the server cancels the lookup and falls back to empty data.
Note:
If from_utc is more than about 11 hours in the past the server will give a 400 Bad Request response. You can request far more than 11 hours, so from_utc is always set to the current UTC timestamp.
Historical sensor data, sampled every five minutes.
61 62 63 64 65 66 |
# File 'lib/hello_sense/sensors.rb', line 61 def sensors_historical(hours:) require 'active_support/all' = Time.now.utc.to_i * 1000 get("/v1/room/all_sensors/hours?quantity=#{hours}&from_utc=#{timestamp}") end |
#update_sensors(data) ⇒ Object
121 122 123 |
# File 'lib/hello_sense/sensors.rb', line 121 def update_sensors(data) post('/v2/sensors', data) end |