That is where Rob is probably correct:
Try using the curl command instead.
That is where Rob is probably correct:
Try using the curl command instead.
Or…create a shell script, as I’ve done for a very similar use case.
Any possibility of providing an example Rob?
I’ve only dabbled with shell scripts.
Sure. I use a set of shell_command
definitions to control my bed:
shell_command:
mbr_bed_mem1: /config/bed-codes/bed mem1
mbr_bed_mem2: /config/bed-codes/bed mem2
and so on
Those call this script:
if [ $# -eq 0 ]; then
echo;
echo "mem1 to mem4: Memory positions 1-4"
echo "flat: Switch to flat position"
echo "vibe1 to vibe4: Vibe modes 1-4"
echo "vibeoff: Turn the vibe off"
echo;
exit 1;
fi
name=/config/bed-codes/$1.bin
result=$(cat $name | nc -n -u -w1 192.168.1.164 50007)
if [ "$result" = "ACK3" ];
then
echo "Success"
else
echo "Failed"
fi
The original script that I wrote use a similar echo -e ....
mechanism as above to generate the binary message, but I ran into some issues doing that on my HA OS setup and I chose to pre-generate the binary content, store it in a set of files, and then just use the script to send the right one. My directory looks like this:
➜ bed-codes ls
bed flat.bin mem1.bin mem2.bin mem3.bin mem4.bin vibe1.bin vibe2.bin vibe3.bin vibe4.bin vibeoff.bin