Testers wanted: new Binding for Internet Radios based on "Frontier Silicon" chipset.

1,159 views
Skip to first unread message

Rainer Ostendorf

unread,
Jan 2, 2015, 1:20:18 PM1/2/15
to ope...@googlegroups.com
Hi all,

i got a "Hama IR110" internet-radio for christmas! As the fact that it was not controllable by OpenHAB was totally unacceptable to me ;), i sat down some hours and hacked down a binding.

Find attached a first version for testing. I only have the Hama radio for testing, but - in theory - it should also work with other radios based on that "Frontier Silicon" chipsets as they use the same
web API. The code can be found in my github repository https://github.com/Osray/openhab, i also created a pull request.

The bindings code is currently based on reverse engineering the protocol and information found on the internet. I requested the official API specs from Frontier Silicon but did not get a response yet.

Cheers,
Rainer


Config-Section in openhab.cfg:
========================

############################### Silicon Frontier Radio Binding ###################################

#

# Hostname/IP of the radio to control

frontiersiliconradio:radio.host=192.168.2.137


# PIN access code of the radio (default: 1234)

frontiersiliconradio:radio.pin=1234


# Portnumber of the radio to control (optional, defaults to 80)

#siliconfrontierradio:radio.port=80



Items:
========================

Switch HamaRadio               "Radio Power" (gRadio) { frontiersiliconradio="radio:POWER" }

Number HamaMode                "Radio Mode [%d]" (gRadio) { frontiersiliconradio="radio:MODE" }

Switch HamaRadioMute           "Radio Mute" (gRadio) { frontiersiliconradio="radio:MUTE" } 

Number HamaRadioVolDimmer      "Radio Volume [%d %%]" (gRadio) { frontiersiliconradio="radio:VOLUME" } 

String HamaPlayInfoName        "Play Info Name [%s]" (gRadio) { frontiersiliconradio="radio:PLAYINFONAME" }

String HamaPlayInfoText        "Play Info Text [%s]" (gRadio) { frontiersiliconradio="radio:PLAYINFOTEXT" }

Number HamaPreset              "Preset" (gRadio) { frontiersiliconradio="radio:PRESET" }



Sitemap (only special variables for preset and mode shown, rest works "as usual", see wiki):

========================

Frame label="Radio Control" {

    Selection item=HamaPreset mappings=[0=1Live, 1=WDR2, 2=SWR3]

    Selection item=HamaMode mappings=[0="Internet Radio", 1=Spotify, 2=Player, 3="AUX IN"]

}

org.openhab.binding.frontiersiliconradio_1.7.0.-SNAPSHOT.jar

Gert Konemann

unread,
Jan 3, 2015, 8:57:23 AM1/3/15
to ope...@googlegroups.com
Rainer,

Thank you for your contribution. I tested the binding with a Medion P85040 (MD 86988) Internet-Radio. I am able to control Power, Mode and Mute, but not Volume and Preset. PlayInfoName and PlayInfoText are displayed correctly. Here are my Items:

Switch WekkerRadio                   "Wekker Power"             <power> (gWekker) { frontiersiliconradio="radio:POWER" }
Number WekkerMode                  "Wekker Mode [%d]" (gWekker) { frontiersiliconradio="radio:MODE" }
Switch WekkerRadioMute            "Wekker Mute"     <volumemute>    (gWekker) { frontiersiliconradio="radio:MUTE" } 
Number WekkerRadioVolDimmer  "Wekker Volume [%d %%]"  <volume> (gWekker) { frontiersiliconradio="radio:VOLUME" } 
String WekkerPlayInfoName        "Wekker Info Name [%s]"         (gWekker) { frontiersiliconradio="radio:PLAYINFONAME" }
String WekkerPlayInfoText          "Wekker Info Text [%s]" (gWekker) { frontiersiliconradio="radio:PLAYINFOTEXT" }
Number WekkerPreset                "Wekker voorkeuze"     <network> (gWekker) { frontiersiliconradio="radio:PRESET" }

In my sitemap:

Frame label="Wekkerradio" {
Switch item=WekkerRadio
Selection item=WekkerPreset mappings=[0="NPO Radio 1", 1="NPO Radio 2 92.6 FM", 2="NPO 3FM On Stage", 3="NPO Radio 4 98.7 FM"]
  Slider item=WekkerRadioVolDimmer
  Selection item=WekkerMode mappings=[0="Internet Radio", 1="Music Player", 2="FM", 3="AUX in"]
Text item=WekkerPlayInfoName
Text item=WekkerPlayInfoText
Switch item=WekkerRadioMute
}

Do you have suggestions how I can find what is going wrong ?

Gert
____________________________________________________________________________
Op vrijdag 2 januari 2015 19:20:18 UTC+1 schreef Rainer Ostendorf:

Gert Konemann

unread,
Jan 3, 2015, 9:40:49 AM1/3/15
to ope...@googlegroups.com
I changed the Volume item to Dimmer. Now the volume works. Still have to find a solution for the Preset. I think the binding has a very high pollingrate and creates too much events in the logfile. For me that is no big problem, but could be for lower power computers like the RPi.

Gert

Op zaterdag 3 januari 2015 14:57:23 UTC+1 schreef Gert Konemann:

Rainer Ostendorf

unread,
Jan 3, 2015, 9:45:41 AM1/3/15
to ope...@googlegroups.com
Gert,

great, thanks for testing! Good to hear that at least some basic functions are working on other devices.

Today i modified the Volume handling a bit, in a way that volume is now always mapped to percent values 0-100. I also added the handling of INCREASE/DECREASE and UP/DOWN command.

Please find attached the new version - that might fix the problems regarding volume handling.

Concerning the preset, i don't know whats going wrong. Could you send me a log with debug messages activated?

For the attached version you need to set the debug level to TRACE for full output as i reduced logging to prevent flooding the log file. Also please be aware that your access pin will be logged in cleartext, so if it shall not get public, please change before.

Thanks again for testing!

Rainer
org.openhab.binding.frontiersiliconradio_1.7.0.-SNAPSHOT.jar

Rainer Ostendorf

unread,
Jan 3, 2015, 9:56:46 AM1/3/15
to ope...@googlegroups.com
Gerd,

concerning the polling-frequency: The binding currently polls the radio every seconds and updates all items. I introduced a config parameter 

siliconfrontierradio:radio.refreshInterval=<time in ms>

but that is not yet functional, at least it did not work when i tested it yesterday, so it was not yet documented. I'm planning on fixing that soon, so everyone can adjust the polling rate as needed.

Rainer

Gert Konemann

unread,
Jan 3, 2015, 4:33:41 PM1/3/15
to ope...@googlegroups.com
Here are 2 logfiles. In radio.log you find a trace-level log of the binding. On line 3656 and further, you can see that a preset change is blocked.
Maybe as a result of that, switching the radio off did not succeed and leads to errors in the consolelog. I hope this helps.

Gert

Op zaterdag 3 januari 2015 15:56:46 UTC+1 schreef Rainer Ostendorf:
radio.log
console-extract.log

Gert Konemann

unread,
Jan 3, 2015, 5:31:01 PM1/3/15
to ope...@googlegroups.com
Rainer,
If I simulate the preset change in a browser with the ssid from the current session, it works.
<fsapiResponse>
<status>FS_OK</status>
<sessionId>1999867191</sessionId>
</fsapiResponse>
<fsapiResponse>
<status>FS_OK</status>
</fsapiResponse>
Now the radio plays another station.

Gert

Rainer Ostendorf

unread,
Jan 4, 2015, 1:44:56 PM1/4/15
to
Gert,

thanks a lot for your logs. I now found some time to have a look at the issue.

Good news is: i am able to reproduce the behavior with my radio. Switching preset also stopped working for me, despite the fact it surely worked when is was testing the feature.

Bad news is: i currently have no clue on why it works with the iPhone Radio app and not with my binding. I did a wireshark packet capture on my iPhone especially for this feature, as is could not get infos on switching the presets. I still have the capture and compared it to my code.

Wireshark dump:

=============================
GET /fsapi/SET/netRemote.nav.action.selectPreset?value=1&pin=1234&sid=1393904546 HTTP/1.1
Host: 192.168.2.137:80
Connection: keep-alive
Accept-Encoding: gzip, deflate
User-Agent: Smart%20Radio/1.3 CFNetwork/711.1.16 Darwin/14.0.0
Accept-Language: de-de
Accept: */*


HTTP/1.0 200 OK
Content-Type: text/xml
Access-Control-Allow-Origin: *
Content-Length: 56



<fsapiResponse>
<status>FS_OK</status>
</fsapiResponse>
=============================

My openHAB log:
=============================
19:09:31.314 TRACE o.o.b.f.i.FrontierSiliconRadioConnection[:164]- calling url: 'http://192.168.2.137:80/fsapi/GET/netRemote.sys.audio.volume?pin=1234&sid=1690947151'

19:09:31.332 TRACE o.o.b.f.i.FrontierSiliconRadioConnection[:179]- got result: <fsapiResponse>

<status>FS_OK</status>
<value><u8>4</u8></value>
</fsapiResponse>
19:09:31.354 TRACE o.o.b.f.i.FrontierSiliconRadioConnection[:71]- status is: FS_OK 
19:09:31.362 TRACE o.o.b.f.i.FrontierSiliconRadioConnection[:119]- value is: 4
19:09:31.368 DEBUG o.o.b.f.i.FrontierSiliconRadioBinding[:140]- volume is 4
19:09:31.374 DEBUG o.o.b.f.i.FrontierSiliconRadioConnection[:277]- converted volume '4' to '12%'

19:09:31.962 DEBUG o.o.b.f.i.FrontierSiliconRadioBinding[:179]- internalReceiveCommand() is called!
19:09:31.983 TRACE o.o.b.f.i.FrontierSiliconRadioConnection[:164]- calling url: 'http://192.168.2.137:80/fsapi/SET/netRemote.nav.action.selectPreset?pin=1234&sid=1690947151&value=1'

19:09:32.025 TRACE o.o.b.f.i.FrontierSiliconRadioConnection[:179]- got result: 
<fsapiResponse>
<status>FS_NODE_BLOCKED</status>
</fsapiResponse>
=============================

If anyone can spot the error, please enlighten me :) Maybe the previous session history has some influence?

I'll investigate this further, as switching stations is a crucial use case..

Rainer

Rainer Ostendorf

unread,
Jan 4, 2015, 2:13:44 PM1/4/15
to ope...@googlegroups.com
Okay, it really seems to be related to the requests that were sent to the radio before. Once i switched Presets using the IOS App, switching presets also works with the binding. This explains why it worked after sniffing the commands.

Problem is, that the app really does a lot of requests upon initialization and that i don't have an official API spec. Will have to find by trial-and-error.

Rainer Ostendorf

unread,
Jan 4, 2015, 3:04:29 PM1/4/15
to ope...@googlegroups.com
Gert,

looks like one has to bring the radio into some "navigation state" by setting SET/netRemote.nav.state to 1, then tune the preset and reset the nav.state back to 0.

This is what the attached binding does, i just tested it successfully with a fresh power-cycled radio and newly restarted openHAB. Hope this fixes the preset-problems. Pull-request is updated.

Rainer
org.openhab.binding.frontiersiliconradio_1.7.0.-SNAPSHOT.jar

Gert Konemann

unread,
Jan 4, 2015, 5:35:05 PM1/4/15
to ope...@googlegroups.com
Great Rainer,

It works here too. This is a useful binding now. I have been thinking of possible improvements:
  1. The high refresh rate generates often zwave errors during openHAB startup. I know there are more bindings having such problems. I assume due to many events at the time. If you can find out how to configure the refresh rate, we could reduce that a bit.. 
  2. Probably it is not necesary to poll all the Items if the radiopower is off. 
  3. Is it possible to use it with more than one radio ? E.g. for two bedrooms with their own Alarm/Radio. I have only one now, so cannot test that.
Thanks for your quick solution of the preset problem,

Gert

Op zondag 4 januari 2015 21:04:29 UTC+1 schreef Rainer Ostendorf:

Rainer Ostendorf

unread,
Jan 5, 2015, 3:29:54 AM1/5/15
to ope...@googlegroups.com
Thanks for the feedback Gert, 

concerning your suggestions:

 1 - i'll try to fix the refreshInterval setting ASAP

 2 - i also thought about this. can't see any disadvantage in not polling turned off devices, so i think i'll implement this

3 - using more than one radio _should_ work. The code is prepared for this. Anyhow, as i also have only  one device, i was not able to test that yet.

Rainer

Patrick Könemann

unread,
May 24, 2015, 6:29:54 AM5/24/15
to ope...@googlegroups.com
Hi Rainer and all other internet radio owners!

The Frontier Silicon Radio binding is contributed :-)
Pull-Requests: 1921 and 2576

I hope the binding will be released soon with openhab 1.7.0 :-)

Tested with the Hama IR110 and Medion MD87180 radios. If you have another internet radio, you could do the check explained in the wiki to determine whether your radio could also be compatible with this binding.

Patrick

Patrick Könemann

unread,
Aug 27, 2015, 5:02:39 AM8/27/15
to openhab
I am currently migrating this binding to Eclipse Smarthome (and openhab 2), and I need your help!
It takes just 2 minutes to gather some information about your radio that would be very helpful for me to auto-detect the radios.

Please follow this guide and post your screenshot: https://community.openhab.org/t/internet-radio-i-need-your-help/2131
Reply all
Reply to author
Forward
0 new messages