Closed bigkraig closed 4 years ago
This repo is already for a custom component. I don't think I want to merge in another component to it. You can make a separate repo and host it. With a little tweaking you could make it more generic and support other types of sensors too.
There are also automations. Here is an automation to do what your component is doing. It takes twice as many lines but you can edit them from the front-end and no restarting.
- id: '11234829350329'
alias: Bedroom Pico - On
trigger:
- entity_id: sensor.bedroom_pico
platform: state
to: '1'
condition: []
action:
- data:
entity_id: scene.lights_on
service: scene.turn_on
- id: '11234829350320'
alias: Bedroom Pico - Off
trigger:
- entity_id: sensor.bedroom_pico
platform: state
to: '4'
condition: []
action:
- data:
entity_id: scene.lights_off
service: scene.turn_on
i've made this because i've got about 15 pico remotes which means 75 automations cluttering up my HA deployment. it's a huge copy/paste effort for each one. its also not realistic to use long presses like that.
I think it belongs in this component since making it generic is going to really complicate the configuration for a remote, if you think about the different button presses and how they behave and when long presses are implemented. it should be a matter of some configuration moves to merge this into the existing lutron_caseta_pro space. something like this:
lutron_caseta_pro:
bridges:
- host: lutron-01f20a33.local
picos:
bedroom:
sensor: bedroom_pico
buttons:
"on":
- data:
group_name: Bedroom
scene_name: Bright
service: hue.hue_activate_scene
"off":
- data:
entity_id: bedroom
service: light.turn_off
@bigkraig : You can easily write a single python_script to reduce the number of automations. I did this, linked below and now I only need to a single automation per pico. That would reduce your automations from 75 to 15. This may solve you issue? See here: https://gist.github.com/catchdave/a6dc17be9a4f55559d12c1a094573707
I completely echo @catchdave's comment above! I use only python scripts with one automation hook for all my Caseta functionality...
Here’s a post I made on the HomeAssistant forums with some explanation of benefits and another sample for you...
https://community.home-assistant.io/t/if-if-else-endif-logic-in-automations/49453/18
Here’s another snippet where I converted a pico into a wall mounted volume control for my home theater...via python script, and it worked really well:
@cajuncoding check out the script mentioned in @catchdave's comment and the comment I left on it, you can then do customize actions on specific buttons, rather than just some standard actions across all picos
WIP regarding what was discussed in #15. The actions do not execute right now, there is some async loop issue I do not understand.
@raerae1616 if you know what needs to be done please LMK, we should also be able to merge your work for long presses into this.
I think overall the lutron component is going to need to move to async since if I press a lot of buttons some will get "stuck" in a down state.