As an Openhab Beginner I would like to aks your for some help with my aim to install a automatic rollershutter shading.
I am using openhab 2.5.6 with Shelly Binding (no mqtt) on a Raspberry PI. The setup is based on the solution of rubenfuser and Peter_Aschinger.
Visual Studio doesn’t show any errors, I can navigate in the sitemap, the sitemap gets update with temperatures, azimuth etc. However, the rollershutter is notmoving at all.
Looks like I have a very basic error in this setup.
Any help / suggestion is highly appreciated.
My shading.item looks like this:
Group gRolloautomatik
/* Shelly 2.5 Roller */
Rollershutter RollerControl “Steuerung (0=offen, 100=geschlossen)” {channel=“shelly:shelly25-roller:c82b96109f49:roller#control”}
Switch Rolloautomatik “Steuerung (0=offen, 100=geschlossen)” //“Automatic blinds closing”
Switch Rolloautomatik_Open “Steuerung (0=offen, 100=geschlossen)” //“Inverts blinds Closing with opening”
Number Rolloautomatik_Closure //“Blinds closed at”
Number Rolloautomatik_Temperature //“Temperature higher than: [%1$.0f]”
Number Rolloautomatik_Cloudiness //“Cloudiness higher than: [%d]”
Number Rolloautomatik_Azimuth //“Sun Azimuth higher or equal to: [%d]”
Number Rolloautomatik_Elevation //“Sun Elevation higher or equal to: [%d]”
DateTime Rolloautomatik_Last_Start //“Last run (Close) [%1$tH:%1$tM %1$td/%1$tm/%1$tY]”
DateTime Rolloautomatik_Last_End //“Last run (Open) [%1$tH:%1$tM %1$td/%1$tm/%1$tY]”
Number External_Temperature { channel=“openweathermap:weather-and-forecast:api:local:current#temperature” } //“Temperature [%.0f]”
Number Local_Cloudiness { channel=“openweathermap:weather-and-forecast:api:local:current#cloudiness” } //“Clouds [%.0f]”
Number Azimuth {channel=“astro:sun:local:position#azimuth”} //“Azimuth [%.0f]”
Number Elevation {channel=“astro:sun:local:position#elevation”}
My shading.sitemap looks like this:
sitemap shading label=“Blinds Auto close”
{
Frame label=“Enable automation”
{
Switch item=Rolloautomatik label="Blinds Auto closure"
Setpoint item=Rolloautomatik_Closure minValue=0 maxValue=100 step=1 label="Blinds closed at: [%s %%]"
}
Frame label="Close if..."
{
Setpoint item=Rolloautomatik_Temperature minValue=0 maxValue=35 step=1 icon="temperature" label="Temperature higher than: [%s °C]"
Text item=External_Temperature icon="temperature" valuecolor=[>27="red",>20="orange",>10="purple",>5="green",<=5="blue"] label="External temperature: [%.0f °C]"
Setpoint item=Rolloautomatik_Cloudiness minValue=0 maxValue=100 step=20 icon="sun_clouds" label="Cloudiness higher or equal than to: [%.0f %%]"
Text item=Local_Cloudiness icon="sun_clouds" label="Cloudiness: [%.0f %%]"
Setpoint item=Rolloautomatik_Azimuth minValue=0 maxValue=360 step=10 icon="niveau" label="Azimuth higher than: [%d °]"
Text item=Azimuth icon="niveau" label="Azimuth: [%d °]"
}
Frame label="Open if..."
{
Switch item=Rolloautomatik_Open label="Enable auto opening"
Setpoint item=Rolloautomatik_Elevation minValue=-20 maxValue=60 step=1 icon="sun" label="Elevation less than: [%d °]"
Text item=Elevation icon="sun" label="Elevation: [%d °]"
}
Frame label="Info"
{
Text item=Rolloautomatik_Last_Start label="Last run (Close) [%1$tH:%1$tM - %1$td/%1$tm/%1$tY]"
Text item=Rolloautomatik_Last_End label="Last run (Open) [%1$tH:%1$tM - %1$td/%1$tm/%1$tY]"
}
Frame label="Reset"
{
Switch item=resetautomatik mappings=[ON="Reset"]
Text item=Rolloautomatik_Last_Start label="Letzter Start [%1$tH:%1$tM - %1$td/%1$tm/%1$tY]"
}
}
And the shading.rules looks like this
var boolean log = true
rule “Blinds closure”
when Item Azimuth changed
then
val String logPrefix = 'Autoblinds (Blinds closure) - ’
if (log) logInfo('rules', logPrefix + 'Rule loaded!')
var String timeLast = 'xxxx-xx-xx'
if (Rolloautomatik_Last_Start.state == NULL)
{
if (log) logInfo('rules', logPrefix + 'First execution on this system.')
}
else
{
timeLast = Rolloautomatik_Last_Start.state.toString().substring(0,10)
}
var String timeNow = now.toString().substring(0,10)
if (Rolloautomatik.state == ON)
{
if (timeNow != timeLast)
{
if (Azimuth.state > Integer::parseInt(Rolloautomatik_Azimuth.state.toString()))
{
if (External_Temperature.state > Integer::parseInt(Rolloautomatik_Temperature.state.toString()))
{
if (Local_Cloudiness.state >= Integer::parseInt(Rolloautomatik_Cloudiness.state.toString()))
{
if (Elevation.state > Integer::parseInt(Rolloautomatik_Elevation.state.toString()))
{
if (log) logInfo('rules', logPrefix + 'Blinds have been closed.') gRolloautomatik.members.forEach
[i| if (i.state <= Integer::parseInt(Rolloautomatik_Closure.state.toString())) {if (log) logInfo('rules', logPrefix + 'Blind set to ' + Rolloautomatik_Closure.state.toString() + '%: ' + i.name) i.sendCommand(Integer::parseInt(Rolloautomatik_Closure.state.toString()))} else {if (log) logInfo('rules', logPrefix + 'Blind already closed (' + i.state.toString() + '%) so rule will be skipped')}]
//sendBroadcastNotification("Auto closure enabled!")
Rolloautomatik_Last_Start.postUpdate(now.toString())
}
else
{
if (log) logInfo('rules', logPrefix + 'Sun elevation (' + Elevation.state.toString() + ') has not reached the value set (' + Rolloautomatik_Elevation.state.toString() + ')')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Cloudiness (' + Local_Cloudiness.state.toString() + ') has not reached the value set (' + Rolloautomatik_Cloudiness.state.toString() + ')')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Temperature (' + External_Temperature.state.toString() + ') has not reached the value set (' + Rolloautomatik_Temperature.state.toString() + ')')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Azimuth (' + Azimuth.state.toString() + ') has not reached the value set (' + Rolloautomatik_Azimuth.state.toString() + ')')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Task finished. The rule will not be executes again today.')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Finished, automation disabled.')
}
end
//-----------------------------------------------//
rule “Blinds opening”
when Item Elevation changed
then
val String logPrefix = 'Autoblinds (Blinds opening) - '
if (log) logInfo('rules', logPrefix + 'Rule loaded!')
var String timeLastEnde = 'xxxx-xx-xx'
if (Rolloautomatik_Last_End.state == NULL)
{
if (log) logInfo('rules', logPrefix + 'First execution on this system.')
}
else
{
timeLastEnde = Rolloautomatik_Last_End.state.toString().substring(0,10)
}
var String timeLastStart = 'yyyy-yy-yy'
if (Rolloautomatik_Last_Start.state == NULL)
{
if (log) logInfo('rules', logPrefix + 'First execution on this system.')
}
else
{
timeLastStart = Rolloautomatik_Last_Start.state.toString().substring(0,10)
}
var String timeNow = now.toString().substring(0,10)
if (Rolloautomatik_Open.state == ON)
{
if (Elevation.state <= Integer::parseInt(Rolloautomatik_Elevation.state.toString()))
{
if (timeLastStart == timeNow)
{
if (timeLastEnde != timeNow)
{
if (log) logInfo('rules', logPrefix + 'Blinds opened') gRolloautomatik.members.forEach
[i| if((Rolloautomatik_Closure.state as Number).intValue <= (i.state as Number).intValue +5 && (Rolloautomatik_Closure.state as Number).intValue >= (i.state as Number).intValue- 5) {if (log) logInfo('rules', logPrefix + 'Blind set to 0%: ' + i.name) i.sendCommand(0)} else {if (log) logInfo('rules', logPrefix + 'Blind not completely opened by script to 0%, because manually managed: ' + i.name)}]
//sendBroadcastNotification("Auto open finished")
Rolloautomatik_Last_End.postUpdate(now.toString())
}
else
{
if (log) logInfo('rules', logPrefix + 'Task finished. The rule will not be executes again today.')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Finished. No task has been executed today. No auto opening can be executed.')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Elevation (' + Elevation.state.toString() + ') has not reached the value set (' + Rolloautomatik_Elevation.state.toString()+ ')')
}
}
else
{
if (log) logInfo('rules', logPrefix + 'Finished, automation disabled.')
}
end
//-----------------------------------------------//
rule “Reset Rollo-Automatik”
when
Item resetautomatik received command
then
Rolloautomatik_Last_Start.state = NULL
Rolloautomatik_Last_End.state = NULL
end