I am writing a device handler for the Chinese NEO Coolcam power plug. I have it working but I would like to add one feature that I cannot seem to get the way I want.
I want the background of the main tile to be dependent on the Watt consumption AND I want the Watt consumption to show in the main list of Things. The idea is that I can have all my metered devices in one ‘Room’ and in a glance see if the power usage is below what I expect (yellow), above what I expect (orange) or ok (green) based on a range you can configure in the settings.
I have managed to show the value of the Watt consumption in the Things list by using:
multiAttributeTile(name:"status", type: "generic", width: 6, height: 6, canChangeIcon: false){
tileAttribute ("device.power", key: "PRIMARY_CONTROL") {
attributeState "val",
label:'${currentValue} W',
backgroundColor:"#79b821",
icon:"st.switches.switch.on"
}
I have also managed to get the correct color in the main screen (after you select the Thing) by using:
multiAttributeTile(name:"status", type: "thermostat", width: 6, height: 6, canChangeIcon: true){
tileAttribute("device.power", key: "PRIMARY_CONTROL") {
attributeState("val", label:'${currentValue} W')
}
tileAttribute("device.powerState", key: "OPERATING_STATE") {
attributeState("off", backgroundColor:"#ffffff")
attributeState("low", backgroundColor:"#ffde00")
attributeState("ok", backgroundColor:"#79b821")
attributeState("high", backgroundColor:"#e86d13")
}
}
and now I would like to combine them but I can’t figure out how to do that.