Thanks!
Okay, I just tried it and it worked too well. I pressed the wall switch, the light came on red (because it was red before it went off, and about four seconds later it turned 4k temp, full brightness. I guess zigbee2mqtt queued it up until it was “communicating”. Impressive. It’s a Sengled bulb.
class SmartBulbSwitch(hass.Hass):
def initialize(self):
self.listen_state(self.state_change, self.args["switch"])
def state_change(self, entity, attribute, old, new, kwargs):
if new == "on":
self.call_service('light/turn_on', entity_id=self.args["bulb"],
color_temp=287, brightness=255)
This is the log
Apr 02 19:21:24 appdaemon[16676]: 2019-04-02 19:21:24.628098 WARNING AppDaemon: OfficeBulbSwitch [16/1818]
Apr 02 19:21:48 appdaemon[16676]: 2019-04-02 19:21:48.763308 INFO AppDaemon: Terminating OfficeBulbSwitch
Apr 02 19:21:48 appdaemon[16676]: 2019-04-02 19:21:48.763552 INFO AppDaemon: Reloading Module: /opt/appdaemon-cfg/apps/smart_bulb_and_switch.py
Apr 02 19:21:48 appdaemon[16676]: 2019-04-02 19:21:48.765734 INFO AppDaemon: Initializing app OfficeBulbSwitch using class SmartBulbSwitch from module smart_bulb_and_switch
Apr 02 19:22:17 zigbee2mqtt:info 4/2/2019, 7:22:17 PM MQTT publish: topic 'zigbee2mqtt/router_hallway', payload '{"state":false,"linkquality":34,"last_seen":1554258137414}'
Apr 02 19:22:22 zigbee2mqtt:info 4/2/2019, 7:22:22 PM Zigbee publish to device '0xb0ce181400052828', genLevelCtrl - moveToLevelWithOnOff - {"level":255,"transtime":0} - {"manufSpec":0,"disDefaultRsp":0} - null
Apr 02 19:22:22 zigbee2mqtt:info 4/2/2019, 7:22:22 PM MQTT publish: topic 'zigbee2mqtt/zb_office_ceiling1', payload '{"state":"ON","linkquality":36,"last_seen":1554184437820,"brightness":255,"color_temp":351,"color":{"x":0.38,"y":0.17},"color_mode":1}'
Apr 02 19:22:22 zigbee2mqtt:info 4/2/2019, 7:22:22 PM MQTT publish: topic 'zigbee2mqtt/zb_office_ceiling1', payload '{"state":"ON","linkquality":36,"last_seen":1554258142830,"brightness":255,"color_temp":351,"color":{"x":0.38,"y":0.17},"color_mode":1}'
Apr 02 19:22:22 zigbee2mqtt:info 4/2/2019, 7:22:22 PM Zigbee publish to device '0xb0ce181400052828', lightingColorCtrl - moveToColorTemp - {"colortemp":287,"transtime":0} - {"manufSpec":0,"disDefaultRsp":0} - null
Apr 02 19:22:23 zigbee2mqtt:info 4/2/2019, 7:22:23 PM Zigbee publish to device '0xb0ce181400052828', genLevelCtrl - read - [{"attrId":0}] - {"manufSpec":0,"disDefaultRsp":0} - null
Apr 02 19:22:23 zigbee2mqtt:info 4/2/2019, 7:22:23 PM MQTT publish: topic 'zigbee2mqtt/zb_office_ceiling1', payload '{"state":"ON","linkquality":36,"last_seen":1554258143273,"brightness":255,"color_temp":351,"color":{"x":0.38,"y":0.17},"color_mode":1}'
Apr 02 19:22:23 zigbee2mqtt:info 4/2/2019, 7:22:23 PM Zigbee publish to device '0xb0ce181400052828', lightingColorCtrl - read - [{"attrId":3},{"attrId":4},{"attrId":7}] - {"manufSpec":0,"disDefaultRsp":0} - null
Apr 02 19:22:23 zigbee2mqtt:info 4/2/2019, 7:22:23 PM MQTT publish: topic 'zigbee2mqtt/zb_office_ceiling1', payload '{"state":"ON","linkquality":34,"last_seen":1554258143511,"brightness":255,"color_temp":287,"color":{"x":0.38,"y":0.17},"color_mode":1}'
Apr 02 19:22:23 zigbee2mqtt:info 4/2/2019, 7:22:23 PM MQTT publish: topic 'zigbee2mqtt/zb_office_ceiling1', payload '{"state":"ON","linkquality":34,"last_seen":1554258143513,"brightness":255,"color_temp":287,"color":{"x":0.38,"y":0.17},"color_mode":1}'