I am really new to this so bear with me. As of now I brighten or dim with when a movie starts in kodi with this:
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.eclipse.internal.xtend.util.StringHelper
import java.util.List
import java.util.ArrayList
rule "Dim_Lights_During_Movie"
when
Item Kodi_LivingRoom_PlaybackState_Raw changed
then
var String json = (Kodi_LivingRoom_PlaybackState_Raw.state as StringType).toString
var String playback_state = transform("JSONPATH", "$.kodi_state", json)
if (playback_state == "started") sendCommand(Light_Living_Room_Ceiling, 12)
end
rule "Raise__Lights_After_Movie"
when
Item Kodi_LivingRoom_PlaybackState_Raw changed
then
var String json = (Kodi_LivingRoom_PlaybackState_Raw.state as StringType).toString
var String playback_state = transform("JSONPATH", "$.kodi_state", json)
if (playback_state == "stopped") sendCommand(Light_Living_Room_Ceiling, 80)
end
I would like this to happen slowly like in a movie theater. Anyone have any ideas or experience doing this?
question, are you controlling the insteon dimmers with the insteonplm binding, or do you also have an insteon controller?
I ask because insteon dimmers have an attribute called ramp rate. However, as far as i know the insteon plm binding does not support adjusting that. If you have an insteon specific controller such as an Isy at your location, I would suggest setting the ramp rate there.
I suppose in theory you could slowly increment the light level of a dimmer within a rule. Not sure how well it would work in practice.
something like:
while light_level < target:
increase light_level + 3%
sleep x milli_seconds
This should be a linear increase in light level, and I am just unsure if that is how it should be done.
I am using the insteonplm binding I have a isy but never used it went straight to openhab as controller.
I am guessing that I have to find a way to find the light level first using your way you described.
I have both, and I would recommend using both. The isy is really good at setting ramp rate, supports scenes, and is very fast at handling insteon messages. it also has a pretty good rules interface.
I would use openhab to send messages to the isy when you need to do insteon things which are dependant on things outside the isy.
Using the ISY, you would set up a movie watching scene. If you had 3 different circuits of lights you wanted to control within the room, you would add them all to that scene as responders. Then you can set ramp rates for each of the lights individually, just for that scene. Likewise, have a movie paused scene with a different configuration of light levels. Openhab doesn’t support scenes. You could set up a switch within openhab that sends a rest call to your isy, to turn a scene on/off. This would allow you to monitor kodi within openhab, then initiate the isy changes over on your isy.
I would recommend poking around the universal devices user forums if you would like some examples for using the ISY. It is a great device for insteon, and has a very helpful community.