top of page

Well as you know, with the RM2, it's possible to get the temperature around this RM2

 

But with the RM BRIDGE application, how, is it possible to get this precious information to send it for exemple to DOMOTICZ, or else application

 

That's what i'll try to explain in that little topic

 

This will be realise in two steps

 

The fisrt step will consist in writing an json form that will be use inside a shell script

the second step will consist to the writing of the shell script that will be a bash script.

 

Don't do that, if you are'nt familiar with linux command

 

Then in my exemple i did realise those topic for a DOMOTICZ application

 

Both files ( script and json command) are place in the same folder, in my totic  (/home/pi/domoticz/scripts)

 

I did use the nano editor, so you can use nano or else ...

 

So let's prepare  the json command fist

 

i did call it "refresh.txt"

 

 

{ "api_id":131,
"command":"rm2_refresh",
"mac": "b4:83:0c:31:6b:c2"
}


 

Those 4 lignes are the Json command, don't forget any line

The line number 3, is the mac adress of your RM2 unit

You will find it when you use the RM2 record mode of the RM BRIDGE application

Note this mac adress and change the line number 3 of this json command for your own mac adress ( don't forget anything during changing action, an cange just the mac adress)

 

 

Then let's prepare the shell script

 

i did call it "returntemp.sh"

 

#!/bin/bash
curl -H "Content-Type: application/json" -X POST -d @refresh.txt http://192.168.1.111:7474> returnprob.txt
cat returnprob.txt $1
value=`cat returnprob.txt`
echo "$value"
pos=15
# echo ${value:${pos}}
echo ${value:15:5} >  temp.txt
var=$(cat temp.txt)
echo $var
curl "http://192.168.1.79:8080/json.htm?type=command&param=udevice&idx=500&nvalue=0&svalue="$var


 

 

 

 

Those script 11 lines are the returntemp.sh script that will be us to get the RM2 Tempature and send it to your DOMOTICZ virtual thermostat

 

So  , first you will have to modify the line number 2, to change 192.168.1.111:7474 for your own unit IP number where you did install the RM BRIDGE ( not the RM2 IP number, but the ANDROID BOX or phone IP number, with the 7474 port

 

Dont mis anything during this modification

 

Then You will have to modify the line number 11 ( the last line of this script )

 

Change 192.168.1.79:8080 fort your own DOMOTICZ unit IP adress ( with your own port , 8080 for me)

On the same line change 500 for your own DOMOTICZ virtual thermostat id number

 

Well if you don't know how to create your own virtual Thermostat refer to DOMOTICZ API topic

 

In fact, it's simple

 

Just go in your DOMOTICZ BOARD

In DUMMY ( virtual moduls)

Create a virtuam modul temperature (not temperature + hygro, but just simple temperature vitual modul)

 

Then in your devices list you will get the virtual thermostat ID number ( note this number to report it in line 11)

 

Ok, that's all

 

Just one thing, don't forget, that you must change refresh.txt and returntemp.sh with the chmod linux command

 

I did use

 

chmod 777 refresh.txt, and chmod 777 returntemp.sh

 

I know, thank 777 is dangerous so use what your want to use, as +x

 

Don't forget that to start your returntemp.sh script, you will have to use ./returntemp.sh inside the folder where the script and the json command are install

 

If you start this returntemp.sh inside the PUTTY console, you will observe all the return informations from the script

 

Of course if you want to get a permanent use of this scipt you will have to use the CRON command under linux  ( refer to the CRON syntax )

 

 

 

 

 

 

 

bottom of page