Skip to content

Instantly share code, notes, and snippets.

@CoMPaTech
Created April 9, 2020 14:04
Show Gist options
  • Save CoMPaTech/7c319acd4a920b7892d5d3b9ada1d17a to your computer and use it in GitHub Desktop.
Save CoMPaTech/7c319acd4a920b7892d5d3b9ada1d17a to your computer and use it in GitHub Desktop.
rfxcom control
#!/bin/sh
rfxcmd="/root/rfx-program/rfxcmd/rfxcmd.py"
#serial=`find /dev/serial/by-id -type l`
serial="/dev/ttyUSB0"
# Beamer (Kingpin)
#09130011E1428041000
# xxxx - 1040 timing/pulse in hex
# xx - Command (24/stop 22/up 28/down)
# xx - sequence number
# Somfy's
#0C1A0015010203010300000000
# xx - Command (00/stop 01/up 03/down)
# xx - ID
# xx - ID
# xx - ID
# xx - sequence number
# rfx_subtype_1A_cmnd = {
# "00":"Stop",
# "01":"Up",
# "02":"Up+Stop (Set upper limit)",
# "03":"Down",
# "04":"Down+Stop (Set lower limit)",
# "05":"Up+Down (Connect motor)",
# "07":"Program",
# "08":"Program > 2 seconds",
# "09":"Program > 7 seconds",
# "0A":"Stop > 2 seconds (Set position / Change direction)",
# "0B":"Stop > 5 seconds (Set middle position)",
# "0C":"Up+Down > 5 seconds (Change upper position)",
# "0D":"Erase this RTS remote from RFXtrx",
# "0E":"Erase all RTS remotes from the RFXtrx"}
sfirst="0C1A0015"
slast="00000000"
sunknown="01"
kfirst="09130011E142"
klast="041000"
case $1 in
"up") scmd="01"
kcmd="22"
;;
"down") scmd="03"
kcmd="28"
;;
"stop") scmd="00"
kcmd="24"
;;
"prog") scmd="07"
kcmd="00"
;;
"learn")
scmd="08"
kcmd="00"
;;
*)
echo "Not sure what to do call me as: $0 {up/down/stop/prog/learn} {id} and I will program 0102{$id}"
exit
;;
esac
id="0102${2}"
type="somfy"
s_string="${sfirst}${id}${sunknown}${scmd}${slast}"
k_string="${kfirst}${kcmd}${klast}"
case $type in
"somfy") string=${s_string}
${rfxcmd} -d ${serial} -s ${string}
;;
*)
echo "Not sure what to do"
exit
;;
esac
See //github.com/digiltd/rfxcmd.git
@CoMPaTech
Copy link
Author

HA id will be 071a0000001 (instead of the script using 0C1A0015)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment