Skip to content

Instantly share code, notes, and snippets.

@pr0way
Last active July 22, 2022 16:35
Show Gist options
  • Save pr0way/fa15c0339cb15132b1eb5091b4e7a869 to your computer and use it in GitHub Desktop.
Save pr0way/fa15c0339cb15132b1eb5091b4e7a869 to your computer and use it in GitHub Desktop.
Hama Radio DIR355BT management script

Simple Hama DIR355BT management script.

I run it from my NAS server as cron job every day to turn on my radio when I go into the kitchen and turn off when I go out to work.

Before use

Make this file executable:

chmod +x hama_dir355bt.sh

Use:

./hama_dir355bt.sh <parameter>
Parameter
on
off

Example:

./hama_dir355bt.sh on

Future ideas:

  • Keep state of previously settings (volume/mode/preset) and change it back before turning off
#!/bin/bash
ACTION=$1
IP="192.168.1.XX" # Change to your device IP
case $ACTION in
"on")
# Turn on
curl "http://${IP}/fsapi/SET/netRemote.sys.power?pin=1234&_=$(($(date +%s%N)/1000000))&value=1"
sleep 1s
# Set radio mode to 0 - Network Radio
curl "http://${IP}/fsapi/SET/netRemote.sys.mode?pin=1234&_=$(($(date +%s%N)/1000000))&value=0"
sleep 1s
# Select favourite station - 3
curl "http://${IP}/fsapi/SET/netRemote.nav.action.selectPreset?pin=1234&_=$(($(date +%s%N)/1000000))&value=3"
sleep 1s
# Adjust volume level to 8 - not too loud
curl "http://${IP}/fsapi/SET/netRemote.sys.audio.volume?pin=1234&_=$(($(date +%s%N)/1000000))&value=8"
;;
"off")
# Turn off
curl "http://${IP}/fsapi/SET/netRemote.sys.power?pin=1234&_=$(($(date +%s%N)/1000000))&value=0"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment