I am not a programmer so it is of no use to me

It should be possible: (link in Dutch) http://www.kopbeveiliging.nl/producten/ ... ng+leerdam
Moderator: leecollings
Code: Select all
DOMOTICZ_SERVER="192.168.0.104:8080"
IDX="67"
TEMP="25"
curl -s -i -H "Accept: application/json" "http://$DOMOTICZ_SERVER/json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEMP"
Code: Select all
#!/bin/bash
# Satelicz v.1.0 by free_nsc
# Reads temperature from Satel inputs
# SERVERPI is Domoticz IP and port
# IDX devid
# NVALUE is the function in Domoticz device 0 holds temperature value
SERVERPI="192.168.1.49:8080"
IDX="7"
NVALUE="0"
SATELIP="192.168.1.7"
SATELPORT="7094"
hex="$(echo -en "\xFE\xFE\x7D\x19\x4F\xA8\xFE\x0D" | nc $SATELIP $SATELPORT | hexdump -v -e ' 1/1 "%02X" " "')"
hexarray=($hex)
echo -n "Satel frame response : "
echo $hex
echo "----------------------------------------"
# echo "Display Byte 03 of the hex array"
# echo -n ${hexarray[3]}
echo -n "Current sensor: "
# This is just to keep list of current sensors and to make sure we are updating the correct device as returned from Integra
case ${hexarray[3]} in
"1C") echo "SatelOutsideTemp" ;;
"19") echo "SatelLivingTemp" ;;
"20") echo "SatelBed1FloorTemp" ;;
"17") echo "SatelBed2FloorTemp" ;;
esac
# Satel returns temp values as follows
# starting from -55.0'C = x00 , -54.5'C = x01, 00.0'c = x6E
# Reading temperature from byte 05
# Convert from HEX to Decimal value
# then have to reduce absolute value by 110 and divide the result by 2
lcTempHex=${hexarray[5]}
lnTempRaw="$(echo $((16#$lcTempHex)))"
lnTempRaw="$(echo $[($lnTempRaw - 110)])"
lcTEMP=$(echo "scale=2; $lnTempRaw / 2.0" | bc)
echo -n "Current temperature reading : "
echo $lcTEMP
echo "----------------------------------------"
echo "Updating Domoticz Device ID : " $IDX
curl -s -H "Accept: application/json" "http://$SERVERPI/json.htm?type=command¶m=udevice&idx=$IDX&nvalue=$NVALUE&svalue=$lcTEMP"
echo "Done."
Code: Select all
function awk_calc_crc16()
{
output=$(echo $1 | awk 'function ord(c){return chmap[c];}
BEGIN{c=65535; for (i=0; i < 256; i++){ chmap[sprintf("%c", i)] = i;}}
{
split($0, chars, "");
for(i = 1; i <= length(chars); i++)
{
cval=ord(chars[i])
e=and(xor(c, ord(chars[i])), 0x00FF);
s=and(lshift(e, 4), 0x00FF);
f=and(xor(e, s), 0x00FF);
r=xor(xor(xor(rshift(c, 8), lshift(f, 8)), lshift(f, 3)), rshift(f, 4));
c=r;
}
}
END{c=xor(c, 0xFFFF); printf("%hu", c);}')
echo $output;
}
Code: Select all
pi@domoticzpi ~/domoticz/scripts $ ./satel.sh
Satel frame response : FE FE 09 01 00 00 00 7D AC FE 0D
----------------------------------------
Im on holidays at the moment but will be testing it from tomorrow.fantom wrote:What would have also added?
I planning add switch "armed" and sensor "alarm"
Fantom
Hello fantom,fantom wrote:More faith in people
I get branch 2659, added my source files and compiled under raspberry pi (linux). Are you use linux or windows ?
This is normal version of domoticz. If you use linux, You may temporary replace binary file 'domoticz', or only stopped original domoticz and run my file.
Basic sources i dropped some time ago : http://www.domoticz.com/forum/tracker.php?p=2&t=558
I think Gizmocuz has a vacation and does not speak from 2-3 weeks.
EDIT. I added output switching today.
Fantom
Users browsing this forum: No registered users and 1 guest