Exploring Smart Home Integration: Lights Out When Kodi Starts

I’ve been diving into the world of smart home automation lately, and I must say, it’s been an exciting journey! One of the things I’ve been trying to set up is a rule to automatically turn off my living room lights when a movie or TV show starts on Kodi. It sounds simple enough, but I’ve hit a few bumps along the way.

So, here’s what I’ve got so far. I’ve set up two String Items in my OpenHAB configuration to track the state and type of what’s playing on Kodi. The items are named kodi_player_state and kodi_player_type. They pull data from Kodi using the XBMC binding, which I’ve configured to update whenever there’s a change in the player state or type.

The rule I’ve written is supposed to trigger when the player state changes to ‘Play’. When that happens, it checks if the player type is ‘episode’ (for TV shows) and then sends a command to turn off the lights in the living room. The rule works perfectly when I remove the condition, meaning the lights do turn off, but as soon as I add the condition to check the player type, it stops working. Hmm, that’s puzzling!

I suspect the issue might be with how I’m accessing the state of kodi_player_type. Since it’s a StringItem, I’m not entirely sure if I’m retrieving its state correctly. I’ve tried logging the state to the console, but nothing shows up. Maybe there’s something about StringItems I’m not fully grasping yet. If anyone has any insights or tips on how to properly access the state of a StringItem, I’d greatly appreciate it!

On a lighter note, this whole process has been a great learning experience. It’s amazing how something that seems straightforward can teach you so much about how different components in a smart home setup interact. I’m looking forward to figuring this out and maybe even sharing some more tips once I get everything sorted out!

If anyone has successfully set up a similar rule or has any advice on troubleshooting this kind of issue, please do share. The community here is fantastic, and I’m sure there’s a lot we can learn from each other’s experiences. Happy automating everyone! :rocket: