Finally, I can create my own light shows for my LIFX bulbs without a phone app and without the cloud. And, I can run the scripts from HA, easily.
About the only credit I can take for this project is that I stumbled onto bardolph. Until this post there has been no mention of it in this community.
The LIFX app is needed to configure new bulbs. It works well, and can perform interesting effects. But, it uses the cloud, works its own way, and I don’t think it can be scripted. For those who want to control their bulbs locally, LIFX gave us the LIFX Lan protocol. It works well, but is definitely not for the feint of heart.
Enter M. L. Clark. He contributed lifxlan, the Python library for accessing LIFX devices locally using the official LIFX LAN protocol. It is comprehensive, and widely used, but still a bit much for my mediocre Python skills.
I looked at a number of facilities built with lifxlan. However, bardolph, grabbed my attention. It promised to reduce the control of LIFX bulbs to a matter of simple text script files. So, I tried it, and it seems to work as advertised. Thank you Al Fontes, Jr.
I run HASSIO in docker on Raspbian on a Pi4B. So, I installed bardolph in Raspbian. Simple, no problems. My testing and scripting also proceeded easily. So, I started looking for a way to integrate bardolph with HASSIO. The LIFX component works for basic bulb control, but doesn’t match the speed or flexibility of bardolph.
HASSIO won’t allow “pip install”, and the Python script component won’t allow “includes”, so I’m looking at custom components and Apdaemon. If anyone could help me with either of those approaches I will be grateful.
So, for now (and maybe the foreseeable future) my integration is via this shell script:
lsrun: ‘ssh -i /config/sshroot/id_rsa -o StrictHostKeyChecking=no -q [email protected] lsrun /usr/share/hassio/share/bardolph/scripts/{{ ls_script }}.ls’
This works fine and allows the script name to be specified in the shell-command service call. My public and private keys live in /config/sshroot on hassio and were specified to Raspbian via ssh-copy-id (core-ssh:/config/sshroot# ssh-copy-id -f -i id_rsa.pub [email protected]). I put my ls scripts in /share/bardolph/scripts/ using the samba add-on to hassio. That directory is reached in Raspbian as in the shell script.
Regarding custom components, I’ve specified bardolph and its dependencies in a manifest and successfully loaded it. But I don’t know how to invoke the loaded .py files. Maybe you do?
If you don’t run Raspbian, you can implement bardolph on a Raspberry Pi 0W for a shade over $10 and adapt the shell-script accordingly (maybe use the -s option of lsrun).
That’s it for now.