openHAB Rules, Items and sitemap for Toon.

Everything about external control, apps, VNC, etc goes here.

Moderators: marcelr, TheHogNL, TerrorSource, Toonz

openHAB Rules, Items and sitemap for Toon.

Postby hdok » Sun Jan 27, 2019 8:23 pm

I have added control for Toon to my openHAB system. Although not as fancy as a binding, it does get the job done. It also makes it possible for me to control Toon outside my own network (through myopenhab). Just sharing as it might help others that use openhab.

Prerequisite:
  • HTTP binding
  • JSONPath Transformation

services/http.cfg
Code: Select all
ToonCacheTherm.url=http://192.168.3.175/happ_thermstat?action=getThermostatInfo
ToonCacheTherm.updateInterval=10000


items/toon.items
Code: Select all
Number KamerTemperature "Kamer temperatuur" { http="<[ToonCacheTherm:10000:JSONPATH($.currentTemp)]" }
Number ToonTemperature "Kamer temperatuur" { http="<[ToonCacheTherm:10000:JSONPATH($.currentSetpoint)]" }
Number ToonState  { http="<[ToonCacheTherm:10000:JSONPATH($.activeState)]" }
Number ToonProgramAan { http="<[ToonCacheTherm:10000:JSONPATH($.programState)]" }


rules/toon.rules
Code: Select all
rule "Set point change"
when Item ToonTemperature changed
then
    sendHttpGetRequest("http://toon.familie-dokter.lan/happ_thermstat?action=setSetpoint&Setpoint="+ ToonTemperature.state.toString)
end

rule "Switch Program state"
when Item ToonProgramAan changed
then
          sendHttpGetRequest("http://toon.familie-dokter.lan/happ_thermstat?action=changeSchemeState&state=" + ToonProgramAan.state.toString)           
end

rule "Switch state"
when Item ToonState changed
then
    sendHttpGetRequest("http://toon.familie-dokter.lan/happ_thermstat?action=changeSchemeState&state=2&temperatureState=" + ToonState.state.toString)   
end


sitemaps/toon.sitemap
Code: Select all
itemap toon label="Toon" {
    Frame label="Thermostaat" icon="thermostat" {
        Setpoint item=ToonTemperature label="Gewenste Temperatuur [%d °C]" icon="temperature" minValue=00 maxValue=3000 step=50
        Text item=KamerTemperature label="Huidige Temperatuur [%d °C]" icon="temperature"
        Selection item=ToonProgramAan label="Progamma" mappings=[0="Uit", 1="Aan"]
        Selection item=ToonState label="State" mappings=[0="Comfort", 1="Thuis", 2="Slapen", 3="Weg"]
        Chart item=KamerTemperature period=W refresh=300
    }
  }
hdok
Starting Member
Starting Member
 
Posts: 18
Joined: July 2018

Return to Toon external control

Who is online

Users browsing this forum: No registered users and 1 guest

cron