Radio LUA script help

Moderator: leecollings

Post Reply
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Radio LUA script help

Post by fergalom »

Could someone tell me why this code does not switch on and set the level of the dummy dimmable switch "Radio Volume" ?

script_device_radio.lua

Code: Select all

commandArray = {}

if (devicechanged['Radio Channels'] == 'CDNX' and otherdevices['Radio Volume'] == 'Off' ) then
        commandArray['Radio Volume'] = 'On'
        print('Radio Volume')
        newlevel = 10
        print(newlevel)
        commandArray['Radio Volume'] = 'Set Level' ..newlevel
        print("radio on")
        print(otherdevices_svalues['Radio Volume'])
end


if (devicechanged['Radio Volume']) then
        v = otherdevices_svalues['Radio Volume']
        os.execute('mpc volume ' ..v)
        print("radio volume " ..v)
end

return commandArray
Extract from the log:

Code: Select all

2016-07-25 12:19:04.310 User: Admin initiated a switch command
2016-07-25 12:19:04.325 LUA: Radio Volume
2016-07-25 12:19:04.326 LUA: 10
2016-07-25 12:19:04.326 LUA: radio on
2016-07-25 12:19:04.326 LUA: 0
2016-07-25 12:19:04.327 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_radio.lua
2016-07-25 12:19:04.311 (DUMMY) Light/Switch (Radio Channels)
2016-07-25 12:19:04.954 Executing script: /home/pi/domoticz/scripts/mpc_CDNX.sh
2016-07-25 12:19:10.040 LUA: radio volume 0
2016-07-25 12:19:09.998 (DUMMY) Light/Switch (Radio Volume)
trixwood

Re: Radio LUA script help

Post by trixwood »

commandArray['Radio Volume'] = 'Set Level' ..newlevel
->
commandArray['Radio Volume'] = 'Set Level ' ..newlevel

you know the space.... between level and the number..
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Radio LUA script help

Post by fergalom »

always the simple things...............thank you!! (it's been driving me nuts)
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Radio LUA script help

Post by Derik »

What radio are u using?
And how?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
trixwood

Re: Radio LUA script help

Post by trixwood »

(it's been driving me nuts)
That's why I quit working in IT 7 years ago :lol:
trixwood

Re: Radio LUA script help

Post by trixwood »

My wild guess is media player classic a software radio player for windows listening to http://www.cdnx.co.uk.
Did I win a prize?
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Radio LUA script help

Post by Derik »

trixwood wrote:My wild guess is media player classic a software radio player for windows listening to http://www.cdnx.co.uk.
Did I win a prize?
Yes you win.... :D :D :D :D

Only the how part... :?:
And the second question.. :idea:
Is there something like this possible with Youtube or 3Fm? :?:
I try to make a Badroom radio... only :-(
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
trixwood

Re: Radio LUA script help

Post by trixwood »

Like this?

https://raspberrytips.nl/internet-radio ... pberry-pi/

Or better:

http://www.dronkert.net/rpi/radio.html <--- Has command line scripting ready to go...
trixwood

Re: Radio LUA script help

Post by trixwood »

Youtube from command line audio only:

http://tsengf.blogspot.nl/2014/12/play- ... ne-on.html
trixwood

Re: Radio LUA script help

Post by trixwood »

But not easier to have like an shows/bath bluetooth/airplay speaker instead of a whole radio?

http://nl.aliexpress.com/store/product/ ... 40191.html

or

http://bathroominspiration.net/bathroom ... eqa-84062/

This one even has FM build in as extra feature...
http://nl.aliexpress.com/item/VTIN-Wate ... 59212.html

This one you can take with you in bath (yes listen to it underwater, you can dive, recommended music: https://www.youtube.com/watch?v=YVxXbTk-zsQ or https://www.youtube.com/watch?v=savCAd6RyPI :lol: )

http://nl.aliexpress.com/item/2016-New- ... 32598.html
trixwood

Re: Radio LUA script help

Post by trixwood »

This is ofcourse the ultimate shower speaker:

http://www.tuvie.com/kohler-moxie-showe ... room-diva/
fergalom
Posts: 74
Joined: Thursday 24 September 2015 11:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Radio LUA script help

Post by fergalom »

Derik wrote:What radio are u using?
And how?
Yes, I use some internet radio stream and also some playlists from my music collection.

I run forked-daapd in the background so I can use my airplay speakers.

Each level of the selector switch calls an internet radio script or a local playlist.
General format of the script is:

mpc_CDNX.sh

Code: Select all

#!/bin/bash
mpc clear
mpc enable 56665 #Airplay1
mpc enable 17552 #Airplay2
mpc add http:/svr1.msmn.co:8136
mpc play
Also have a selector switch to select which speakers I want to stream to.
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Radio LUA script help

Post by Derik »

yes yes...
I was looking @:
https://www.mopidy.com/
More options then the others?[ not eol ]

Only there a so maaaaaany rpi players..
Rune is nice only not a good api..

What should be the best overal player.
So 1 device plays all.
Mp3 youtube spoti google air etc etc etc..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
trixwood

Re: Radio LUA script help

Post by trixwood »

I would buy a dedicated pi zero and like a wireless shower speaker, hook it up and put kodi on it... json api, plays everything, remote app on your tablet phone... tons of plugins... think it would set me back 50 euro total.
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Radio LUA script help

Post by Derik »

trixwood wrote:I would buy a dedicated pi zero and like a wireless shower speaker, hook it up and put kodi on it... json api, plays everything, remote app on your tablet phone... tons of plugins... think it would set me back 50 euro total.
MM

Why did i not think about this option....
[Perhaps you have a nice how to? ]
Think Kodi is the best option..


Thanks...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
trixwood

Re: Radio LUA script help

Post by trixwood »

Only the basic ones:

http://kodi.wiki/view/HOW-TO:Install_Ko ... spberry_Pi
https://www.domoticz.com/wiki/Kodi
http://kodi.wiki/view/JSON-RPC_API/v6

do not know how you connect bluetooth speaker... I got airplay. But probably very simple.

Kodi has a domoticz plugin like domoticz has a kodi plugin ;-)

Control Domoticz
http://forum.kodi.tv/showthread.php?tid=180840

NL Radio streams:
http://bigfoot87.com/radiostreams/

Control HUE
https://github.com/michaelrcarroll/scri ... .ambilight

I do not run it on a pi anymore, kodi v15 was ok (pi on both osx), v16 was a disaster on osx bug ridden piece of crap, v17 works ok again on osx.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest