Hi, I’m following this tutorial to create dimmable actions using aqara button, but I’m just stuck with the function node at the moment.
I’m not quite sure how to import the properties from the sonoff bulbs into the function node. This is what I’m getting from the developer tools
Grouped sonoff bulbs
min_mireds: 153
max_mireds: 500
effect_list:
- Bright
- Color
- Night
- Party
- Reading
- Relax
- Sleep
- Soft
- Vivid
- White
supported_color_modes:
- color_temp
color_mode: color_temp
brightness: 19
color_temp: 500
hs_color:
- 30.601
- 94.547
rgb_color:
- 255
- 136
- 13
xy_color:
- 0.599
- 0.382
effect: White
entity_id:
- light.sonoff_1001310700
- light.sonoff_1001310281
- light.sonoff_100131158c
- light.sonoff_100130ff0e
- light.sonoff_10013104fb
icon: mdi:lightbulb-group
friendly_name: Master Bedroom Night Lights
supported_features: 4
Single bulb
min_mireds: 153
max_mireds: 500
effect_list:
- Color
- White
- Bright
- Sleep
- Reading
- Night
- Party
- Relax
- Soft
- Vivid
supported_color_modes:
- color_temp
color_mode: color_temp
brightness: 19
color_temp: 500
hs_color:
- 30.601
- 94.547
rgb_color:
- 255
- 136
- 13
xy_color:
- 0.599
- 0.382
effect: White
manufacturer: QM Smart Cloud
model: QMS-5C-RGB
sw_version: BOL-ZHI-ML v1.0.0
cloud: online
friendly_name: Bulb 1
supported_features: 7
The function node that I’m trying to edit
update variables
flow.set('yeelight1_on',msg.payload.state.on);
flow.set('yeelight1_bri',msg.payload.state.bri);
flow.set('yeelight1_colormode',msg.payload.state.colormode);
flow.set('yeelight1_ct',msg.payload.state.ct);
flow.set('yeelight1_hex',msg.payload.state.hex);
flow.set('yeelight1_hue',msg.payload.state.hue);
flow.set('yeelight1_sat',msg.payload.state.sat);
smart dimming
var x = flow.get('yeelight1_bri')
if(x <= 125){
msg.payload = x;
return[msg,null];
}
if(x > 125){
msg.payload = x;
return[null,msg];
}