Script to send value from one domoticz to another one
Moderator: leecollings
-
- Posts: 14
- Joined: Monday 14 May 2018 15:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Script to send value from one domoticz to another one
Is it possible to make a script to send a temp value or rain or wind etc to another domoticz on a easy way? I know it is possible to connect domoticz together but I just want to send a few values to a friends domoticz. An mqtt broker are also able to use if it makes it easier...
/ tage
/ tage
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script to send value from one domoticz to another one
Yes is possible:
My first option would be to use a JSON-API Look here from a dzVents script using the domoticz.openURL() command
My first option would be to use a JSON-API Look here from a dzVents script using the domoticz.openURL() command
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 14
- Joined: Monday 14 May 2018 15:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to send value from one domoticz to another one
Aah that sounds easy
/json.htm type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEMP
But how do I get my value in to that "temp" ?
/json.htm type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEMP
But how do I get my value in to that "temp" ?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script to send value from one domoticz to another one
In its most basic form (dzVents script)
- Spoiler: show
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: Script to send value from one domoticz to another one
You could do this in a bash script:
it produces a clean temperature in format XX.X
then you can sent it to your friend:
In short, retreive your value, sent it to your friends domoticz.
But why the hard way? you also would have to make a planning for say every five minutes sent an update (run the script), while this can all be done with the domoticz connection (make new user for your friend and limit his acces to the temp device you want to share).
Code: Select all
Temp=$(curl -s "YOUR_DOMOTICZ_SERVER/json.htm?type=devices&rid=TEMPERATURE_DEVICE_IDX" | jq '.result[0].'Temp'' | tr -d '"')
then you can sent it to your friend:
Code: Select all
curl -s "YOUR_FRIENDS_DOMOTICZ_SERVER/json.htm?type=command¶m=udevice&idx=FRIENDS_DEVICE_IDX_HERE&nvalue=0&svalue=$Temp"
But why the hard way? you also would have to make a planning for say every five minutes sent an update (run the script), while this can all be done with the domoticz connection (make new user for your friend and limit his acces to the temp device you want to share).
-
- Posts: 14
- Joined: Monday 14 May 2018 15:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to send value from one domoticz to another one
thx for helping me.. did a quick test and the dzvents script didnt work i got this error :
guessing it is for i dont use beta version ?
have not try the bash script but should not be to hard to try that
/ tage
Code: Select all
2018-05-18 06:37:44.278 Error: EventSystem: in /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua: /home/pi/domoticz/scripts/dzVents/runtime/EventHelpers.lua:567: attempt to concatenate local 'vv' (a table value)
have not try the bash script but should not be to hard to try that
/ tage
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script to send value from one domoticz to another one
More than likely. openURL is part of dzVents > 2.3.0
Would be moving to Beta an option for you ?
Moving is a relatively easy step and providing you have a backup (and tested the restore) without a big risk.
Would be moving to Beta an option for you ?
Moving is a relatively easy step and providing you have a backup (and tested the restore) without a big risk.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 14
- Joined: Monday 14 May 2018 15:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to send value from one domoticz to another one
Upgraded to beta and it seems to work
And the script also working ! Thx.
Is it possible to lower the decimals of the value ?
Right now it is like this : 18.3212456
18.3 should be enough.
/ tage
And the script also working ! Thx.
Is it possible to lower the decimals of the value ?
Right now it is like this : 18.3212456
18.3 should be enough.
/ tage
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script to send value from one domoticz to another one
@tage
Sure, change to
Sure, change
Code: Select all
tostring(trigger.temperature)
Code: Select all
tostring(dz.utils.round(trigger.temperature,1))
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: No registered users and 1 guest