Tuesday, 7 April 2026
Homelab
Saturday, 10 January 2026
Digital Picture Frame III
Intro
My Digital Picture Frame was successfully implemented in October 2025. It has a web interface which makes it easy to select galleries to display. The randomiser, choosing a first picture to display, helps retain interest. The display webpage has proved reliable.
There was some inconvenience in setting up, starting and stopping the show which I have addressed as the final part of the project using Home Assistant
1/ The TV needed to be turned on/off manually - HA can do this.
2/ HA now has a voice assistant "Jarvis" which I would like to start and stop the slideshow rather than using HA on PC, iPad or Laptop
3/ To avoid needless long-term i/o and SD card damage, turn off the slideshow each night in CRON.
TV Control
The small Samsung TV I use to display a slideshow is very old (2014) and only a little bit SMART.
There is an old "Samsung Smart TV" HA integration available which can turn the TV on or switch between HDMI and TV input.
Also the TV has a chromecast stick and the HA Chromecast integration can control some TV functions.
Thirdly I have a Broadlink IR sender which can duplicate TV remote Control functions.
There is a small issue: the Raspberry PI uses the HDMI2 input, so I need to make sure that regardless of whether the TV was previously in TV or HDMI1 or HDMI2 or something else I need to switch to HDMI2. There isn't an entity which tells me which input is used or one which allows me to switch to HDMI2.
After some trial and error I use a sequence of "Samsung Smart TV" and "Chromecast" commands to turn the TV on and select HDMI2.
Script to Start and Stop Slideshow
The Digital Picture Frame web page uses a websocket interface which allows it to run a bash script on the web server (PI41). The script invokes a python program "pictureparm.py" on PI41 to pause / resume the slideshow and change which gallery art is displayed.
The Home Assistant server (PI42) requires the capability to run "pictureparm.py". We can execute a command on a remote server using SSH.
Next I set up a HA shell command called slideshow_start so that I can easily run the command from a HA script.
Finally the TV22_slideshow script, brought everything together.
It runs some "Chromecast" and "Samsung Smart TV" commands to turn the TV on and change it to HDMI2, which is the source connected to the PI41 server.
The script can then run the SSH shell command to start the slideshow running on the PI41 server screen.
Jarvis Voice Assistant
As an enthusiastic HA user I was excited to see that Nabu Casa have designed a Voice Assistant to rival Alexa and Google Home. The Google Home interface to HA is somewhat tortuous and I certainly dont want to venture into the world of Alexa.HA Voice isn't fully developed yet but obviously it is well integrated into HA and is somewhat more secure than alternatives as it can keep data processing local.
HA Voice is easy enough to setup using the instructions provided. I select "Jarvis" as the control word.
Using the Voice Assistant we simply associate the command "Start Slideshow" with our script and say the words.๐๐๐CRON
As our slideshow runs in the background and I can watch it or do something else it is quite easy to forget it is running. Since the slideshow reads continually from an SD card, this could lead to issues with the media if I leave it. I schedule a CRON job each evening at 23:00 to stop the show if necessary.
OUTRO
This project has changed significantly from its starting point. I was particularly keen that the result is something that I can use easily and it has exceeded my expectations in this respect. Doing some technical stuff to start the show isn't conducive to regular use as it is a hassle. A verbal command makes all the difference. Secondly, the image on a small TV screen is visible and can be watched or ignored so I can just start the slideshow and watch when I am interested. As there are usually a number of exhibitions within a show there are likely to be some pictures I am interested in.
In conclusion this is a worthwhile use of time, I have learned plenty and have an enjoyable result.
Tuesday, 1 April 2025
Zigbee
In my study I have a very good Philips Hue dimmable light bulb. I can easily control it on my iPad with the Philips app. However, it really doesn't want to be controlled by Home Assistant (HA) and is very reluctant to be configured in Google Home(GH). Previously with lots of effort I managed to configure it in GH then control it via a link from HA to GH. When this stopped working, as you do, I googled a solution.
Unsurprisingly there were plenty of moans from HA people about Philips and the consensus was that it was better to control their lights through Zigbee. I know almost nothing about Zigbee but decided this was a good opportunity to find out.
Zigbee is a low-power wireless protocol suitable for devices like bulbs and switches. A single device called a Zigbee co-ordinator (ZC) talks to Zigbee End Devices (ZED) to make up a network. You can build a mesh network by adding Zigbee routers (ZR) which can communicate with ZC and ZED. The Philips Hue "bridge" incorporates a ZC so that it can communicate with the bulbs.
The Sonoff Zigbee dongle is a popular ZC and it costs very little so I sent off for one from Ali Express.It only took a couple of weeks to arrive and I was quickly able to plug it in to my HA server. HA discovered it automatically.
So we now have wifi, bluetooth and zigbee communication available to us.
Wednesday, 15 January 2025
Virgin TV Automation
Intro
In September 2024 it was time to participate in the annual Virgin vs Sky renewal debate. Virgin come up with a deal each year to make it too much hassle for me to change over to Sky. This year the deal required a mandatory upgrade from Tivo to Virgin TV Go 360. Our set top box remains the same but the Tivo software has been replaced by Horizon from Liberty Global, Virgins parent company. The new software looks more up-to-date / standard and has a few more features, for example personal profiles and voice control through the remote.
In addition to watching recordings on the TV from the Virgin set-top box we also watch downloaded films / series from our home server. Fiddling around with multiple remote controls is becoming more of a pain, particularly when the programme maybe on the Tivo, available via catchup or downloaded onto the local network. I felt it was time to come up with a better solution based on a browser application.
Approach
Home Assistant (HA) can be used to control a wide variety of electronic devices. As well as integrating with most vendors IoT apps, the open source community has added many more "integrations" for a myriad of devices.
In my scenario I would like a HA running on an iPad or phone to provide all the functions I currently use on the Samsung TV, Virgin V6 set-top-box and Yamaha Soundbar with remote controls.
Samsung TV has its own HA integration and also an IoT app called Smart Things which HA can utilise.
Virgin has its TV Go app which is closely integrated with the V6 box but isn't incorporated into HA.
The Yamaha soundbar only has an infra-red remote control interface so any automation would need to be integrated using a Broadlink IR sender.
Solution
My intention was to combine Samsung, Tivo and Soundbar(Broadlink) functions into a single web browser based HA dashboard. The project seems to be never-ending so I will outline the solution as it currently stands and, maybe, provide more technical detail and describe enhancements later. The screen layout changes, depending on whether you are using Samsung TV or Virgin Tivo functions and the two layouts are shown below.
The power button switches TV, Tivo and Soundbar on/off at the same time. The green sound buttons allow you to change the soundbar volume or mute it.
We dont currently make use of them but I have included Youtube and Internet browser buttons to access the built in functions which Samsung provide.
Conclusion
- All devices are powered on/off by a single button instead of using three different remotes.
- Most days, the app is all we need, the remotes aren't required.
- All viewing sources are grouped together making it easier to find/choose the one you need.
- A single button press is required to access Virgin recordings - instead of about 6
- A single button press is required to access download folders - instead of about 6
- Presets are available for favorite Tivo channels as necessary
- Parental codes can be entered with a single button
Samsung TV
The HA Samsung integration can select between TV+ and HDMI sources, change channels and simulate pressing buttons on the remote control. An improved integration is available on a github repository by ollo69. It has some extra features
In particular, it can use the SmartThings API to obtain better information about channels/sources and has more remote controller key-press capabilities.
Our basic script to send one or more key presses uses the standard SamsungTV remote HA entity to send a command to the living room tv. "{{ key_sequence}}" is an argument providing the key definitions.
The Youtube app is "111299001912" and the Internet browser is "org.tizen.browser"
For Netflix and Amazon I couldn't get the apps to work, so I had to use a sequence of remote control keys.
The sequence of keys shown on the left: HOME, followed by right-arrow three times then Enter starts Amazon.Saturday, 4 February 2023
Smart Light Switch and bulb
As a Christmas present I requested and received a smart wall light switch for my study. I want to be able to turn the light on or off using Google Home (GH) voice commands.
Choosing a switch
There is a technical difficulty replacing a traditional switch with a smart one. Strange as it may seem there is a power problem. Wall switches typically just have a live wire going in, through the switch and out again. We cant use a single wire to power anything. A clever solution is to add a capacitor in the ceiling rose which provides the necessary charge/current to operate wifi. I had to make sure I ordered a "no-neutral" switch.
Hardware installation
Installing the wall switch is easy, though the wall box for mine isn't quite deep enough so I installed a spacer to make it fit neatly. Similarly the ceiling capacitor went in nicely. I used a very convenient video from Geek Street to make sure I did it right. Once I had completed the install the switch worked fine as a light switch - to me this is good progress ๐
Adding the Switch
The switch can be added to the SmartLife app which discovers it easily when you select "Add device". It is now possible to switch on and off the light using SmartLife.
Home Assistant (HA) can see a new switch in the Tuya (i.e. SmartLife) integration. After restarting HA I can switch the light on and off using a dashboard switch. I added the switch to my lights dashboard page.
The switch is also visible to Google Home and I added it into the Study devices. Now it is included if I ask google for "lights on" when I am in the study.
We have made very good progress and the switch is fully working and controllable and I started to think about a dimmer.๐
Philips Hue 100W (equiv) dimmer
Previously I had a dimmer switch for the study room light but my room bulb wasn't very bright in the first place and I didn't use it. I saw an advert for a Philips Hue 1600 lumen warm light dimmable bulb. the bulb is supposed to be compatible with Home Assistant and Google Home. At £20 it isn't outrageously expensive compared with some other Hue products so I bought one.Hue installation
I needed a new "Philips Hue" app on my iPad. As expected the light was discovered and I could adjust the brightness. I was very impressed that full brightness is equivalent to a 100W bulb and I now have a bright light suitable for electronics work. 70% brightness is fine most of the time and 50% gives the room a warm cozy ambience. By default, if you switch off and on with the wall light, the bulb comes on at full brightness rather than remembering the previous setting. This avoids a problem if you turn the brightness right down and it appears the bulb isn't working.
Google Home setup
I experienced some problems configuring Hue in Google Home. In theory it should be discovered automatically but, although I tried repeatedly I couldn't get GH to do this. Lots of documentation refers to the need for a bridge; older Hue lights were controlled from a bridge/hub which communicated with them using Zigbee wireless protocol. Mine is a new one which also has bluetooth obviating the need for a hub and Philips documentation confirms this. A reddit post provided inspiration for a fix - I did a factory reset on Hue within the Hue app and deleted the wifi device from my iPad. GH still didn't discover the bulb immediately, but when I told it that the device was a light which supported "Seamless Device Setup" it was added. Looking at lighting devices in my study I can now see a switch and a dimmer for the ceiling light. When I tell Google "lights off" or lights 50% Google will adjust it for me.๐
Home Assistant
Earlier I had no success making the Hue Bluetooth known to HA which only seems interesting in the old-fashioned Bridge version. It occured to me there may be a way of accessing GH devices from HA. Luckily for me the functionality appears to have been implemented in the latest version 2023.1 of HA.
Even better the "EverythingSmartHome" channel has an excellent youtube tutorial on the subject which was published a couple of weeks ago.
I followed the tutorial to add a new integration "Google Assistant SDK". As part of the procedure I had to setup Google Credentials on the Google Cloud Developers Console. These provide a link between Google Assistant (GA) and Home Assistant so that HA can send commands to GA.
There is a neat interface into GA, you send commands from HA to GA as text versions of GA voice commands. Following the tutorial I added a new Service to HA using the SDK and sent a command to dim the lights exactly as if I had said "Hey Google, lights dim 50%".๐
Monday, 2 January 2023
TV Viewing with Home Assistant and Chromecast
Previously I have investigated the capabilities of Chromecast (CC). In addition to providing a number of apps to make a TV "smart" and play free / chargeable content, CC provides the capability to "cast" to the TV content from phone, iPad or PC. Home Assistant (HA) leverages the casting capability, allowing me to choose media within HA and play it on the TV.
In effect, I now have the same capability for video as I do for music but the question remains what use is it? When finding and playing a youtube video, it is usually easiest to use a PC or iPad. When watching a film, it is usually easiest to save it in DLNA and use the TV remote to select it.
HA webhooks allow you to use Chrome to select scripts or automations which HA executes for you. For example I can easily setup a webhook to play a Youtube video on the TV and I can use an input form to select the youtube id I want to play. I found a number of videos that I (or Harry Junior) may want to watch simply by pasting the appropriate URL into a web page.
It would be simpler to setup a drop down menu of choices but even better, especially for Harry Junior, is to be able to press the icon for one of his favourite videos on the iPad and watch it on the TV. As of January 2023 "Speedie Didi" is his preferred vlogger so I set up a number of her videos for him.
I may setup more webpages along these lines if they prove useful. It would certainly make it easier to find yotube videos I want to watch repeatedly.
Wednesday, 21 December 2022
Chromecast
About eight years ago we purchased a small Samsung "Smart TV". At the time we thought it was very clever as it has an ethernet connection which allowed us to use an inbuilt web browser and iPlayer. Subsequently it was used as a computer screen and to play media from a DLNA server.
I now want to integrate it with Home Assistant so that we can start and control videos as we do for music. Unfortunately the Smart TV is not smart enough for this so I purchased a Chromecast to help it.
Chromecast installation and testing
As expected there is a slick installation procedure and I soon have the Chromecast working on HDMI with the usual apps such as Netflix, ITVhub available.
Chromecast provides extra connectivity capabilities.
We can easily cast youtube or iplayer from the phone to Chromecast.
On the ipad we can cast from youtube, vlc or iplayer.
On the PC we can cast a chrome browser session to the TV allowing us to see whatever is displayed or playing in the browser. Alternatively you can cast videos from the youtube app or vlc.
All these facilities are great but I probably wouldn't use them much in practice, so I now need to see what extras Home Assistant can offer.
Home Assistant
HA has a Google Cast integration built in and uses it to send speech or music to the Google Nest mini. As far as HA is concerned the TV, with Chromecast attached, is just another casting device.
Using the "Browse Media" button on the card for the TV you can select a video from the DLNA server or local media and play it on the TV. This is a great start, we can already play videos of our choice and it is as simple to use from HA as it is selecting DLNA directly on the TV.Looking at the sample in Google Cast integration it is easy to setup a script to cast a video to the TV. The service is media_player.play_media, the target is media_player.john_study_tv and you just need to provide a URL and type for the media content. Running this script causes the video to play. Now that I have a script I can use a webhook or Google Assistant command to initiate the video so I have the basis of a solution.
You can also play youtube videos by specifiying suitable media_content details:
Conclusion
Monday, 25 July 2022
More MQTT Clients
We setup an MQTT broker on Home Assistant (HA) so that our Lily ESP32 super remote can communicate with it. MQTT facilitates many different systems to interact and clients can communicate with each other as well as the broker.
Linux MQTT
RPi MQTT client installation is easy, I just install mosquitto-clients onto the RPi and I can send messages at the command line with mosquitto_pub.
If I use the same topic and message as Lily it has the same effect, for example in the example below I publish "button 3" to topic esp32/volume and HA arranges for the volume to be turned up on my Sony Amplifier.
This is great for testing but it is unlikely that I will use the linux command line much. However I would like to send MQTT messages using a browser, this allows me to send messages from phone/ipad/pc.
Browser MQTT
The Eclipse Paho MQTT javascript client appears to be a popular choice for a browser javascript MQTT client and Steves Internet Guide provides a very clear example to get a client working. The browser javascript client communicates with websockets on the MQTT broker and after some searching I found that in addition to the MQTT port 1883, HA supports websockets and the broker websocket listener is on port 1884.
Using Steves Internet Guide it was easy to setup javascript MQTTconnect/disconnect functions, associated with buttons on a simple webpage. The handlers required to deal with connection success / failure and incoming messages are also simple to implement so I can show the status of the connections and any messages received on a page. Finally I provided"volume up" and "volume down" buttons to demonstrate that I can now control my amplifier volume by sending MQTT commands to HA so that it can tell the Broadlink IR sender to send volume up/down commands to the amplifier.
The result is the very simple test webpage shown below. I can now easily implement MQTT functionality into other webpages which need to control devices in the home, in particular my home music server.
It is great that MQTT is a flexible general purpose communications protocol which will work for many different devices.
Webhooks
Early on in my HA investigations I setup webhooks so that I can trigger HA automations from a webpage. At the time I was more interested in voice control using Google Assistant and webhooks duplicate what is more readily achieved through voice.
However it occured to me that if I can use parameters / arguments with webhooks they make a realistic alternative to MQTT for communication with HA. Webhooks communicate directly with HA rather than needing to connect to the MQTT broker and sending a payload.
HA documentation indicates that it is possible:
Webhooks are implemented using POST requests which I can most easily provide using a linux curl command
I had some difficulty seeing the payload in HA until I added the -H parameter to specify JSON format. However once this was resolved I could write an automation which displays the payload trigger.json.payload as a HA notification when the message is received.
Of course I want to use webhook URLs in a webpage so I coded a form to send an input text box named payload. In this case the item containing the information is trigger.data.payload. Rather than sending an input text field I can add one or parameters to the webhook URL containing directives for HA. I added a parameter called arg to the webhook URL and could access it in a HA template as trigger.query.arg. The example below shows both the form item payload and the URL arg being sent from a webpage. The URL arg is displayed as a HA notification whilst the payload is sent to Google Nest mini to be read aloud.
Saturday, 9 July 2022
HA : ESPHome : RFID Reader
Previously, I installed ESPHome with a simple indicator, showing whether a GPIO pin was hi or lo.
Many devices we use with Home Assistant (HA) have specific home automation interfaces. ESPHome extends HA functionality by providing an interfaces for many more sensor components which can measure the environment somehow. ESPHome provides the capability to interact with RFID readers and cards / tags.
I purchased three RC522 readers on Ebay and they turned out to be very simple to setup.
There are ways we could use the cards. I could present a card to the reader when I enter or leave the room and everything could be setup for me. Baby Harry could have a variety of cards to do things when he wants them.
I did check whether NFC on my phone is acceptable to the reader. It does register and send a tag id to HA, but the tag is different each time, possibly as it uses more sophisticated security, so it isn't much use to me.
Tuesday, 14 June 2022
HA : WLED
I purchased a WS2812B LED strip over a year ago. The LEDs are individually addressable, allowing you to set up patterns on the lights. I didn't get around to doing anything with them until I saw that they can be controlled using an app called WLED which in turn can be integrated with Home Assistant (HA). I think the W in WLED stands for wifi; LEDs are connected to an ESP8266 which controls them and the WLED iPAD app allows you to configure patterns.
Arduino Setup
My first task was to setup an ESP8266 and connect the LED strip. I used an article by mechatronics to guide me, it shows the connections are very simple.
The sketch shows that displaying a pattern is simply a matter of putting correct colour values in the array leds[] and calling FastLED.show to display them. They pattern can be made to change by adding loop to the sketch specifying how the pattern changes each time. It gives me complete control of which LEDs are are used, what colours they are and when they change from a C program๐
WLED Install
WLED runs on an ESP8266 to control the strip. It has a ultra-cool website URL kno.wled.ge which provides the relevant installation instructions. WLED is loaded into the ESP8266 using a utility esptool.py. I downloaded esptool.py and WLED 0.13.1 to WSL then ran esptool.py to flash WLED onto the ESP8266. ESP8266 starts up with an access point WLED-AP. I attach to WLED-AP and go to address 4.3.2.1 in my browser to connect to the ESP program.
WLED is surprisingly complicated to use; there are over 100 effects you can use to create LED patterns and a variety of colour palettes you can choose. You can set the speed, select groups of LEDs and string a sequence of patterns together.
Luckily there are various youtube tutorials to help you and kno.wled.ge provides a list. I used a couple of tutorials by Dr zzs to give me the general idea.
WLED API
I dont find it easy to setup devices based on a graphical user interface, it is too easy to forget/overlook details. WLED provides both HTTP and JSON APIs allowing you to control WLED remotely. JSON is the newer, more complete interface which is easier to code / read so I concentrated on setting up some JSON configs. Curl is used to send WLED API commands, as a simple example the following command turns the LED strip on.
In practice it is better to put the json into a file, the example below causes WLED to blink LEDs 30 to 40 in the strip between blue and green.
Now that I have a mechanism to program WLED I can create a variety of configs for the lights. WLED allows you to setup presets to store configurations; once I have downloaded a configuration I save it in a preset.
HA and GA
There is a HA native integration for WLED making it trivial to include it within the system. HA allows you to control individual elements, however I think it is easier to setup presets as shown above then invoke them within HA.
Now WLED can be controlled by running a HA script and I can set up a routing in Google Home for voice control of LEDs, job done๐