***Now UPDATED to work with the latest versions of HA and Local Tuya***
Tested and working on Home Assistant 2022.2.5 with Local Tuya v3.4.0
.
If anyone’s interested; here’s how I have it setup.
Main picture - Turns ON Fan and Light
Fan lower left - Toggle Fan - Spins when ON
Palette Icon - Select colour, brightness and effects - Icon changes to selected colour
Fan(1) - SET Mist Low
Fan(2) - SET Mist High
You will need to have " custom button-card " installed for this to work. Install this through HACS.
Also the image you would like displayed to be in your " www " folder and saved as " diffuser.jpg "
FAN - DPS 1
LIGHT - DPS 5
SCRIPT
Diffuser :
This toggles the Fan and Light; there are other settings you can play with here but I selected just these two.
For the Sequence you will need two Call service Action types. The first one to toggle the Fan; the second to toggle the Light.
Select Call service for the 1st Action type and " fan.toggle " in Service and pick your device.
Select Call service for the 2nd Action type and “light.toggle” in Service and pick entity.
Save this. Test to see if it’s working by pressing the Play button in Scripts Menu.
Paste this code into a Manual Card
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: picture-entity
image: /local/diffuser.jpg
tap_action:
action: call-service
service: script.diffuser
service_data: {}
target: {}
show_name: true
aspect_ratio: '1.2'
entity: fan.spray
- type: horizontal-stack
cards:
- type: custom:button-card
state:
- value: 'on'
color: yellow
styles:
icon:
- animation:
- rotating 1.5s linear infinite
- value: 'off'
color: black
tap_action:
action: toggle
entity: fan.spray
show_name: false
- type: button
tap_action:
action: more-info
entity: light.diffuser_led
icon: mdi:palette
show_name: false
show_state: false
- type: custom:button-card
color_type: null
color: null
show_state: true
size: 40%
icon: mdi:fan-speed-1
styles:
icon:
- color: |
[[[
if (states['fan.spray'].attributes.oscillating == 'small') return 'yellow'; return 'black';
]]]
tap_action:
action: call-service
service: localtuya.set_dp
service_data:
device_id: your-device-id-goes-here
dp: 2
value: small
- type: custom:button-card
color_type: null
color: null
show_state: true
size: 40%
icon: mdi:fan-speed-2
styles:
icon:
- color: |
[[[
if (states['fan.spray'].attributes.oscillating == 'large') return 'yellow'; return 'black';
]]]
tap_action:
action: call-service
service: localtuya.set_dp
service_data:
device_id: your-device-id-goes-here
dp: 2
value: large
You will need to change 2 sections within this code, your-device-id-goes-here with your device_id.
Tested and working on Home Assistant 2022.2.5 with Local Tuya v3.4.0
SAVE. Done.
Hopefully it works.