module
ShellyplugExporter::Gen::Helper::JsonHelper
Defined in:
shellyplug_exporter/gen/helper/json_helper.crClass Method Summary
-
.as_f?(value : JSON::Any | Nil) : Float64 | Nil
Shelly firmwares serialize whole numbers without a decimal point, which JSON::Any#as_f? rejects, so accept integers as well.
-
.compact(readings : NamedTuple) : Hash(Symbol, Float64 | Int64)
Drops the readings the plug did not report, so a failed or partial response yields no sample instead of a misleading zero.
Class Method Detail
def self.as_f?(value : JSON::Any | Nil) : Float64 | Nil
#
Shelly firmwares serialize whole numbers without a decimal point, which JSON::Any#as_f? rejects, so accept integers as well.
def self.compact(readings : NamedTuple) : Hash(Symbol, Float64 | Int64)
#
Drops the readings the plug did not report, so a failed or partial response yields no sample instead of a misleading zero.