The GE Fan switches that I have don’t work properly for the LED control. The ‘always off’ doesn’t work on the older (non zwave+) model. The new version doesn’t work at all (even with this app). BUT…
This app is to toggle the LED so that it is always off. While most of my switches are set to ‘On when light on’, in our master bedroom we often have the fan on at night and the LED is like a homing beacon so whether the fan was on or not, I couldn’t win.
So I built this app that turns it off regardless of the state of the switch:
import appdaemon.appapi as appapi
#
# App to turn manage LED notification on GE Switch
#
# EXAMPLE appdaemon.yaml entry below
#
# LED Control:
# class: GE_switch_led_control
# module: GE_switch_led_control
# entities:
# - entity: fan.master_bedroom_fan_level
# parameter: '3'
# off_value: 'LED on when light on'
# on_value: 'LED on when light off'
# - entity: fan.living_room_fan_level
# parameter: '3'
# off_value: 'LED on when light on'
# on_value: 'LED on when light off'
#
#
# Arguments
#
# entity: the entity that is being monitored
# parameter: the zwave parameter that you would like to update
# off_value: the value to send when the device is 'off'
# on_value: the value to send when the device is 'on'
#
# Release Notes
#
# Version 1.0:
# Initial Version
#
#
# ####################################################################
# ####################################################################
class GE_switch_led_control(appapi.AppDaemon):
def initialize(self):
if "entities" in self.args:
for item in self.args["entities"]:
entity = item["entity"]
node_id = self.get_state(entity, "node_id")
parameter = item["parameter"]
off_value = item["off_value"]
on_value = item["on_value"]
msg = "{} setup for LED control using Node ID {}.".format(self.friendly_name(entity), node_id)
self.log(msg, "INFO")
self.listen_state(self.state_changed, entity=entity, node_id=node_id, parameter=parameter, off_value=off_value, on_value=on_value)
else:
msg = "GE Switch LED Control enabled but no entities configured."
self.log(msg, "INFO")
def state_changed(self, entity, attribute, old, new, kwargs):
node_id = kwargs["node_id"]
parameter = kwargs["parameter"]
off_value = kwargs["off_value"]
on_value = kwargs["on_value"]
if new == "on":
value = on_value
else:
value = off_value
msg = "{} is now {}, setting Zwave value to: {}.".format(self.friendly_name(entity), new, value)
self.log(msg, "INFO")
self.call_service("zwave/set_config_parameter", node_id=node_id, parameter=parameter, value=value)
def log_notify(self, msg, level):
self.log(msg, level)
self.call_service("notify/notify", message=msg)