Controlling Toon via Pimatic

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

Moderators: marcelr, TheHogNL, TerrorSource, Toonz

Controlling Toon via Pimatic

Postby debans » Fri Jan 11, 2019 3:23 pm

Hello all, i'm new the the domoticaforum, but reading for a while.
Recently i own a Toon, and have rooted it.

I use Pimatic to for home automation https://pimatic.org/
And wanted to control the Toon.
So i used the manual to Controlling Toon via Domoticz to create the manual for Controlling Toon via Pimatic

Image
debans
Starting Member
Starting Member
 
Posts: 2
Joined: January 2019

Re: Controlling Toon via Pimatic

Postby TheHogNL » Fri Jan 11, 2019 4:49 pm

NIce to see a new user adding the Toon to a new home automation platform! Please share the details and the manual.
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 666
Joined: August 2017

Re: Controlling Toon via Pimatic

Postby debans » Fri Jan 11, 2019 5:01 pm

Step 1:
You need to install the following plugins to Pimatic:
  • Cron
  • log-reader
  • shell-execute

Step 2:
To get the actual information from the Toon every minute.
You can change the frequency of crawling the information.
Add the next code to the Rules section:
Code: Select all
    {
      "id": "toongetthermostatinfo",
      "name": "ToongetThermostatInfo",
      "rule": "when every 1 minute then execute \"curl -s 'http://192.168.1.111/happ_thermstat?action=getThermostatInfo' | jq '.' > /home/pi/pimatic-app/ToonThermostatInfo\"",
      "active": true,
      "logging": false
    }


Step 3:
Create a LogWatcher divice to get the data from the logfile
To create a LogWatcher device getting and converting the data from the logfile, created by the rule.
Add the next code to the Devices section:
Code: Select all
    {
      "id": "toonthermostatinfo",
      "name": "ToonThermostatInfo",
      "class": "LogWatcher",
      "file": "/home/pi/pimatic-app/ToonThermostatInfo",
      "attributes": [
        {
          "name": "currentTemp",
          "type": "number"
        },
        {
          "name": "currentSetpoint",
          "type": "number"
        },
        {
          "name": "programState",
          "type": "string"
        },
        {
          "name": "activeState",
          "type": "string"
        },
        {
          "name": "nextProgram",
          "type": "number"
        },
        {
          "name": "nextState",
          "type": "number"
        },
        {
          "name": "nextTime",
          "type": "number"
        },
        {
          "name": "nextSetpoint",
          "type": "number"
        }
      ],
      "lines": [
        {
          "match": ".currentTemp.:..(.+)..",
          "currentTemp": "$1:100"
        },
        {
          "match": ".currentSetpoint.:..(.+)..",
          "currentSetpoint": "$1:100"
        },
        {
          "match": ".programState.:..0..",
          "programState": "Off"
        },
        {
          "match": ".programState.:..1..",
          "programState": "On"
        },
        {
          "match": ".programState.:..2..",
          "programState": "Temporary"
        },
        {
          "match": ".programState.:..4..",
          "programState": "Holiday"
        },
        {
          "match": ".activeState.:..-1..",
          "activeState": "Manual"
        },
        {
          "match": ".activeState.:..0..",
          "activeState": "Comfort"
        },
        {
          "match": ".activeState.:..1..",
          "activeState": "Home"
        },
        {
          "match": ".activeState.:..2..",
          "activeState": "Sleep"
        },
        {
          "match": ".activeState.:..3..",
          "activeState": "Away"
        },
        {
          "match": ".activeState.:..4..",
          "activeState": "Holiday"
        },
        {
          "match": ".nextProgram.:..(.+)..",
          "nextProgram": "$1"
        },
        {
          "match": ".nextState.:..(.+)..",
          "nextState": "$1"
        },
        {
          "match": ".nextTime.:..(.+)..",
          "nextTime": "$1"
        },
        {
          "match": ".nextSetpoint.:..(.+)..",
          "nextSetpoint": "$1"
        }
      ],
      "xAttributeOptions": []
    }



Step 4:
Create 2 Variable Devices tho show the statuses

To show the actual temperature and the setpoint temperature
Add the next code to the Devices section:
Code: Select all
    {
      "id": "toontemp",
      "name": "Toon",
      "class": "VariablesDevice",
      "variables": [
        {
          "name": "temperature",
          "expression": "round($toonthermostatinfo.currentTemp / 100,1)",
          "type": "number",
          "unit": "°C",
          "acronym": "Temp"
        },
        {
          "name": "setpoint",
          "expression": "round($toonthermostatinfo.currentSetpoint / 100,1)",
          "type": "number",
          "unit": "°C",
          "acronym": "Setpoint"
        }
      ],
      "xAttributeOptions": []
    }


To show the actual status of the active scheme and the program
Add the next code to the Devices section:
Code: Select all
    {
      "id": "toonschemeinfo",
      "name": "Toon",
      "class": "VariablesDevice",
      "variables": [
        {
          "name": "state",
          "expression": "$toonthermostatinfo.activeState",
          "label": "Scheme",
          "acronym": "Schema"
        },
        {
          "name": "program",
          "expression": "$toonthermostatinfo.programState",
          "label": "Program",
          "acronym": "Program"
        }
      ],
      "xAttributeOptions": []
    }


Step 5:
Create 2 Button Devices tho toggle the program and the schemes

To create a button device for turning the auto program on or off.
Add the next code to the Devices section:
Code: Select all
    {
      "id": "toonprogram",
      "name": "Toon Program",
      "class": "ShellButtons",
      "buttons": [
        {
          "id": "on",
          "text": "On",
          "onPress": "curl -s 'http://192.168.1.111/happ_thermstat?action=changeSchemeState&state=1'"
        },
        {
          "id": "off",
          "text": "Off",
          "onPress": "curl -s 'http://192.168.1.111/happ_thermstat?action=changeSchemeState&state=0'"
        }
      ]
    }


To create a button device for the 4 different schemes.
Add the next code to the Devices section:
Code: Select all
    {
      "id": "toonscheme",
      "name": "Toon",
      "class": "ShellButtons",
      "buttons": [
        {
          "id": "SetAway",
          "text": "Away",
          "onPress": "curl -s 'http://192.168.1.111/happ_thermstat?action=changeSchemeState&state=2&temperatureState=3'"
        },
        {
          "id": "SetSleep",
          "text": "Sleep",
          "onPress": "curl -s 'http://192.168.1.111/happ_thermstat?action=changeSchemeState&state=2&temperatureState=2'"
        },
        {
          "id": "SetHome",
          "text": "Home",
          "onPress": "curl -s 'http://192.168.1.111/happ_thermstat?action=changeSchemeState&state=2&temperatureState=1'"
        },
        {
          "id": "SetComfort",
          "text": "Comfort",
          "onPress": "curl -s 'http://192.168.1.111/happ_thermstat?action=changeSchemeState&state=2&temperatureState=0'"
        }
      ]
    }


Done
You now have a fully working Toon with Pimatic.
debans
Starting Member
Starting Member
 
Posts: 2
Joined: January 2019


Return to Toon external control

Who is online

Users browsing this forum: No registered users and 0 guests

cron