I’ve been using the Caseta Pico remotes along with some information that I’ve found on the forums to mimic the functionality of Pico remotes to control Zigbee lights through ZHA. I’ve been using stephack’s pico blueprint along with the reccommendations from KennethLavrsen to stop the transition using bri_inc=0 and this implementation. I then read the brightness state through another manual command. I’m using zha_toolkit to implement that functionality to make finding the ieee easer.
I then use a read command to read back the brightness value. I also found that if I didn’t cancel the transition before turning the lights back on, if the light is currently in a transition state, it will turn the light back off, so I added the cancel command again before turning lights on if I press the on button. I spent a while getting it right, so here is the example code for doing it with the blueprint and ZHA-toolkit with the device id’s replaced in case you’re interested.
alias: Office Pico
description: ""
use_blueprint:
path: stephack/core-pico.yaml
input:
pico_remote: 00000000000000000000000000000000
up_raise:
- service: light.turn_on
data:
brightness: 255
transition: >-
{{(((255-states.light.office_closet.attributes.brightness|default(0))/255)*4.9)+0.1}}
target:
device_id: 00000000000000000000000000000000
entity_id: light.office_closet
up_raise_release:
- service: zha_toolkit.execute
data:
ieee: light.office_closet
cluster: 8
endpoint: 10
cmd: 3
command: zcl_cmd
- service: zha_toolkit.attr_read
data:
cluster: 8
endpoint: 10
ieee: light.office_closet
attribute: 0
state_id: light.office_closet
state_attr: brightness
bottom_off_release:
- service: zha_toolkit.execute
data:
ieee: light.office_closet
cluster: 8
endpoint: 10
cmd: 3
command: zcl_cmd
- service: light.turn_off
data:
transition: 2
target:
device_id: 00000000000000000000000000000000
entity_id: light.office_closet
down_lower:
- if:
- condition: not
conditions:
- condition: device
type: is_off
device_id: 00000000000000000000000000000000
entity_id: light.office_closet
domain: light
then:
- service: light.turn_on
data:
brightness: 4
transition: >-
{{((states.light.office_closet.attributes.brightness|default(0)/255)*5)+0.1}}
target:
device_id: 00000000000000000000000000000000
entity_id: light.office_closet
down_lower_release:
- service: zha_toolkit.execute
data:
ieee: light.office_closet
cluster: 8
endpoint: 10
cmd: 3
command: zcl_cmd
- service: zha_toolkit.attr_read
data:
cluster: 8
endpoint: 10
ieee: light.office_closet
attribute: 0
state_id: light.office_closet
state_attr: brightness
top_on_release:
- service: zha_toolkit.execute
data:
ieee: light.office_closet
cluster: 8
endpoint: 10
cmd: 3
command: zcl_cmd
- service: light.turn_on
data:
brightness: 255
target:
device_id: 00000000000000000000000000000000
entity_id: light.office_closet
This works really well to mimic the normal operation of a pico remote through sending all of the manual ZHA commands. That said, if I wanted to do the same thing with an actual caseta dimmer (pico to caseta dimmer without using middle button in order to use that button to trigger effects), I’m not sure how I would do that. I want to be able to use the middle button of my caseta switch to trigger automations, but I don’t know that there is a similar method for cancelling transitions and manually reading the brightness state through the caseta integration. I’d imagine that it must technically be possible as this seems to be how Caseta would be doing it, but I’m not sure how it would be done practically or if the proper features are exposed.
Thanks!