Controlling Toon via Pimatic

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

Moderators: marcelr, TheHogNL, Toonz

Post Reply
debans
Starting Member
Starting Member
Posts: 4
Joined: Fri Jan 11, 2019 3:24 pm

Controlling Toon via Pimatic

Post by debans »

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
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: Controlling Toon via Pimatic

Post by TheHogNL »

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
debans
Starting Member
Starting Member
Posts: 4
Joined: Fri Jan 11, 2019 3:24 pm

Re: Controlling Toon via Pimatic

Post by debans »

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.
djmvt
Starting Member
Starting Member
Posts: 4
Joined: Thu Oct 10, 2019 11:43 pm

Re: Controlling Toon via Pimatic

Post by djmvt »

I've installed a Toon thermostat yesterday and in all my enthusiasm started to put your code in my config.json on pimatic, tried it, got a lot of errors and finally realised I've completely ignored the part where you wrote you rooted your Toon hahaha


But since I want to use Google home speech control with toon rooting is not an option for now, as far as I've seen.

Thanks anyway, I'll save the config.json just in case I want to root the Toon in the future!
TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Controlling Toon via Pimatic

Post by TerrorSource »

djmvt wrote:I've installed a Toon thermostat yesterday and in all my enthusiasm started to put your code in my config.json on pimatic, tried it, got a lot of errors and finally realised I've completely ignored the part where you wrote you rooted your Toon hahaha


But since I want to use Google home speech control with toon rooting is not an option for now, as far as I've seen.

Thanks anyway, I'll save the config.json just in case I want to root the Toon in the future!
Why isn't rooting an option? After rooting, the Toon is more compatible with Domotica systems then a non-rooted Toon.
djmvt
Starting Member
Starting Member
Posts: 4
Joined: Thu Oct 10, 2019 11:43 pm

Re: Controlling Toon via Pimatic

Post by djmvt »

TerrorSource wrote: Why isn't rooting an option? After rooting, the Toon is more compatible with Domotica systems then a non-rooted Toon.
Because I will have to figure out how to keep speech control with Google home on a rooted toon. Haven't found any links about that yet but when I do find them I will probably root it :)
djmvt
Starting Member
Starting Member
Posts: 4
Joined: Thu Oct 10, 2019 11:43 pm

Re: Controlling Toon via Pimatic

Post by djmvt »

I've finally got the time to root my toon thermostat.
Now i'm trying to integrate it in pimatic but the rule

{
"id": "toongetthermostatinfo",
"name": "ToongetThermostatInfo",
"rule": "when every 1 minute then execute \"curl -s 'http://192.168.1.111/happ_thermstat?act ... mostatInfo' | jq '.' > /home/pi/pimatic-app/ToonThermostatInfo\"",
"active": true,
"logging": false
}

is not working for some reason. I guess it has something to do with how the curl command is executed (placement of brackets and such) but I can't seem to figure it out. any ideas?
djmvt
Starting Member
Starting Member
Posts: 4
Joined: Thu Oct 10, 2019 11:43 pm

Re: Controlling Toon via Pimatic

Post by djmvt »

Nevermind, got it figured out!
Now to make a buttons device to set manual temperature :)
Post Reply

Return to “Toon external control”