diff --git a/shard.yml b/shard.yml index 548e8bd3..c4d5f550 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: placeos-driver -version: 6.9.18 +version: 6.9.19 crystal: ">= 1.0.0" dependencies: diff --git a/src/placeos-driver/interface/sensor.cr b/src/placeos-driver/interface/sensor.cr index dbac883b..ab84fda4 100644 --- a/src/placeos-driver/interface/sensor.cr +++ b/src/placeos-driver/interface/sensor.cr @@ -109,11 +109,13 @@ abstract class PlaceOS::Driver def initialize( @type, @value, @last_seen, @mac, @id, @name, @raw = nil, @loc = nil, @status = Status::Normal, @limit_high = nil, @limit_low = nil, - @resolution = nil, @module_id = nil, @binding = nil, @unit = nil + @resolution = nil, @module_id = nil, @binding = nil, @unit = nil, + @modifier = nil ) end property status : Status + property modifier : String? property type : SensorType property value : Float64 @@ -167,6 +169,11 @@ abstract class PlaceOS::Driver Units::Measurement.new(self.value, this_unit).convert_to(other_unit).to_f end + + def modified_type : String + return "#{@modifier} #{@type}" if @modifier.presence + @type.to_s + end end end end