Method: WeatherLink::Station#local_sensors

Defined in:
lib/weatherlink/station.rb

#local_sensorsObject



62
63
64
65
66
67
68
69
# File 'lib/weatherlink/station.rb', line 62

def local_sensors
  @local_sensors ||= current.health.select { |s| s.include?('ip_v4_address') }.map do |health|
    sensor = client.sensor_by_lsid(health.lsid)
    device_id_hex = sensor.parent_device_id_hex
    device = client.node_by_device_id_hex(device_id_hex) || client.stations_by_device_id_hex(device_id_hex)
    LocalSensor.new(device: device, host: health.fetch('ip_v4_address'))
  end
end