I’m trying to make blueprints for myself and some friends. The issue is that I prefer Zigbee2mqtt over ZHA while they prefer ZHA.
Thus I’m currently making 2 versions of the scripts because they act slightly differently based on the integration.
The main issue is device selection, atm I allow pretty much any “device” based on the script to be used, IE if I make an ikea switch, all switches including non-ikea ones are listed becase the model and manufacturer name can differ from zha and zigbee2mqtt.
My most recent example is Aqara Cube T1 Pro
ZHA:
Manufacturer: LUMI
Model: (Can’t remember atm)
Zigbee2Mqtt:
Manufacturer: Xiaomi
Model: Aqara magic cube T1 Pro (CTP-R01)
Is there a way to include multiple manufacturers and models if the script is known to be compatible with them?
If so, I could make 1 script and a selector based on ZHA and Z2M which would be easier to maintain.
Have you tried just adding another integration in the list to see if it works?
You mention the T1 Pro cube…
Would you be interested in popping over to the zigpy git and thumb up the issue I’ve had up there for 11 months to fo mane a new profile for the T1 Cube so we can actually use all the features of it on ZHA like throw function and hold function? These have been implemented in Z2M since January…
Also with the multiple ways people can set Z2M up, I use MQTT to talk to to those devices. It fixed a lot of my problems with people not figuring out why theirs don’t work… It also lets me create helpers using MQTT discovery so the users don’t have to.
Sure I can thumb up that issue, seems like an oversight not to have those functions working. I’ll try adding multiple integrations but I suspect it won’t work because “duplicate key integration”, I’ve had that before when 2 keys are reused. A list with integrations does not work unfortunately.
I’ve added a partial blueprint on how I’d try to solve it.
Essentially, you’d have a selector based on which you’d choose a different action sequence:
blueprint:
name: Test blueprint
author: ""
description: ""
source_url: https://PLACEHOLDER
domain: automation
input:
#I include a condition selector by default
run_conditions:
name: Conditions
description: |
Only run when these conditions are met.
(Remove Time Condition if not needed)
default:
- condition: time
selector:
condition:
#Choose between ZHA and Zigbee2MQTT
zha_or_z2mqtt:
name: Choose which integration your devices use
description: The blueprint works differently depending on which integration you use.
default: zha
selector:
select:
options:
- label: Use ZHA
value: zha
- label: Use Zigbee2MQTT
value: z2m
#Select ZHA Entities
zha_entities:
name: ZHA entities
description: Select your entities here if you're using ZHA
selector:
target:
entity:
- integration: zha
#Select Zigbee2MQTT Entities
z2mqtt_entities:
name: Zigbee2MQTT entities
description: Select your entities here if you're using Zigbee2MQTT
selector:
target:
entity:
- integration: mqtt
mode: single
#Variables for use in calculations and statements
variables:
zha_or_z2mqtt: !input zha_or_z2mqtt
#Triggers
trigger:
#YOUR_TRIGGERS
#Conditions
condition:
- condition: !input run_conditions
#Actions
action:
- choose:
#choose this action sequence when ZHA is selected
- conditions:
- condition: template
value_template: '{{ "zha" in zha_or_z2mqtt }}'
sequence:
- service: #YOUR_SERVICE
target: !input zha_entities
#choose this action sequence when Zigbee2mqtt is selected
- conditions:
- condition: template
value_template: '{{ "z2m" in zha_or_z2mqtt }}'
sequence:
- service: #YOUR_SERVICE
target: !input z2mqtt_entities