Newbie with scripting how to get the setpoint of thermostat

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
Lebo2d9
Posts: 139
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version: L stab
Location: Belgium
Contact:

Newbie with scripting how to get the setpoint of thermostat

Post by Lebo2d9 »

Hi,

I'm new in scripting. I want to read the set point of a thermostat. But i don't know how to get only the set point value.

Below you can find the code i already have

Code: Select all

#!/bin/bash
#--Get Domotics Device
curl 'http://127.0.0.1:8080/json.htm?type=devices&rid=181'
And this is what i get in response

Code: Select all

{
   "ActTime" : 1491285800,
   "ServerTime" : "2017-04-04 08:03:20",
   "Sunrise" : "07:11",
   "Sunset" : "20:18",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "17.5",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 4,
         "HardwareName" : "Dummy",
         "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
         "HardwareTypeVal" : 15,
         "HaveTimeout" : true,
         "ID" : "0014105",
         "LastUpdate" : "2017-04-02 23:05:27",
         "Name" : "Schakel temperatuur verwarming",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "SetPoint" : "17.5",
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "SetPoint",
         "Timers" : "false",
         "Type" : "Thermostat",
         "TypeImg" : "override_mini",
         "Unit" : 1,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "181"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
I only want to use the SetPoint value but i don't know how i can do this
Can someone help me with that?

Kind regards
Koen
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Newbie with scripting how to get the setpoint of thermostat

Post by emme »

you can use JQ utility under bash to parsing JSON data... (install with sudo apt-get install jq )

Code: Select all

SETPOINT=$(curl 'http://127.0.0.1:8080/json.htm?type=devices&rid=181' | jq '.restult.SetPoint')
(did not test it.... but it could work like this)
The most dangerous phrase in any language is:
"We always done this way"
Lebo2d9
Posts: 139
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version: L stab
Location: Belgium
Contact:

Re: Newbie with scripting how to get the setpoint of thermostat

Post by Lebo2d9 »

Hi,

Thx for the reply.
The final code is

curl -s 'http://127.0.0.1:8080/json.htm?type=devices&rid=181'| jq -r '.result[] |.SetPoint'
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest