Hello everyone.
Im updating the OTGW plugin with some additionals. How can i change the booleans in the code below to the presencesensor class? so instead of true/false it shows the PresenceSensor layout.
class OTGWThermostat extends env.devices.Device
_flame = false
attributes:
Flame:
description: "Flame status"
type: "boolean"
constructor: (@config) ->
@id = @config.id
@name = @config.name
plugin.otgw.on("flame_status" , (data) =>
if data.length = 16
@_setFlame(@_bitToBool(data.slice(12,13)))
)
super()
#Getters
getFlame: () -> return Promise.resolve @_flame
#Setters
_setFlame: (state) ->
if @_flame isnt state
@_flame = state
@emit 'Flame', state
#Functions
_bitToBool: (value) ->
return (value is "1")