I actually have no experience using/building JSON files, and have been using REST commands to interact with the addon itself by changing the payload
. For example, I use the following command to apply a theme to my devices and then start the “move” effect at the same time - one command.
photons_effects_move_new_theme:
url: 'http://192.168.1.205:6100/v1/lifx/command'
method: "put"
payload: '{"command": "effects/run", "args": {"matcher": {"label": {{ label }} }, "linear_animation": "MOVE", "linear_options": {"power_on": false, "speed": {{ speed }} }, "apply_theme": true, "theme_options": {"colors": {{ colors }}, "power_on": false, "overrides": {"brightness": {{ brightness }} } } }}'
You can use these REST commands to basically control the entirety of Photons, such as applying themes, starting effects, starting Photons-specific animations, etc. The only thing that changes is the payload
, which I can give more examples if you need, but I think the link above might have some as well.
Anyway, I made separate, generic REST commands for everything like applying themes, stopping effects, etc, and you’ll notice variables like {{ label }}
and {{ colors }}
, which allow for dynamic REST commands to change the devices, speed, colors, brightness, etc. at the script level instead of needing separate REST commands for every possible combination.
So here’s a simple script I have that runs the above REST command:
photons_move_cooling_beam:
sequence:
- service: rest_command.photons_effects_move_new_theme
data:
label: '"Beam"'
speed: 10
colors: >
["hex:#0f4ffb", "hex:#198df8", "hex:#5cf7f1", "hex:#adfed4", "hex:#d4fff3"]
brightness: '{{ state_attr("light.beam", "brightness")|float / 256 }}'
You can see the service is simply the REST command itself, and then you can specify all the data below, where "Beam"
is the name of my Beam, the speed at which the Move effect is applied, the colors of the theme you want, and then the brightness. And you can make many more scripts that apply the same REST command but with different parameters, if you’d like.