We have moved at community.getvera.com

Author Topic: openLuup: AV plugins  (Read 32362 times)

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
openLuup: AV plugins
« on: October 27, 2015, 11:15:26 am »
Questions here to do with Sonos, DLNA, Squeezebox, ... configuration.

But see separate thread for Cameras, BlueIris, ...
« Last Edit: October 27, 2015, 01:26:22 pm by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline mda

  • Sr. Member
  • ****
  • Posts: 464
  • Karma: +9/-0
Re: openLuup: AV plugins
« Reply #1 on: October 29, 2015, 01:07:01 am »
@akbooer i am getting ready to install the DLNA plugin on openluup on my mac. I have lua5.1, luasocket, luasec, and the latest openluup from github installed and  running.

Can i trouble you to please provide instructions and links to anything else that needs to be installed on a Mac before installing the DLNA plugin?

Also, could you possibly summarize any changes that need to be made to the DLNA plug in files here in this thread? Are these files the right starting point? http://code.mios.com/trac/mios_dlna-cntroller/browser/tags/1.4

I realize this info is probably in various places in  the other threads but if you would not mind i think it would be very helpful to me and other openluup noob's to have all the steps in one place. Thanks !

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup: AV plugins
« Reply #2 on: October 29, 2015, 06:01:40 am »
/usr/bin/GetNetworkState.sh

Some plugins (particularly Sonos, DLNA, Squeezebox, because they've all borrowed from the same source) require an external shell script (part of a standard Vera installation) to define the host machine IP address.

There's two basic ways to implement this.

This file can either be VERY simple:

Code: [Select]
echo -n 172.16.42.22

...with the IP address appropriately set (manually)

or a more sophisticated approach using a Lua script to return the result (automatic) which is described here:
http://forums.coronalabs.com/topic/21105-found-undocumented-way-to-get-your-devices-ip-address-from-lua-socket/

Code: [Select]
#! /usr/bin/env lua
------------------------------------------------------------------------
-- discover main IP address of machine and write to standard output
-- http://forums.coronalabs.com/topic/21105-found-undocumented-way-to-get-your-devices-ip-address-from-lua-socket/
------------------------------------------------------------------------
local socket = require "socket"
function myIP ()
  local mySocket = socket.udp ()
  mySocket:setpeername ("42.42.42.42", "424242")  -- arbitrary IP/PORT
  local ip = mySocket:getsockname ()
  mySocket: close()
  return ip or "127.0.0.1"
end
io.write (myIP())
--------

After creating this file in /usr/bin you need to make it executable with the following shell command

Code: [Select]
chmod a+x /usr/bin/GetNetworkState.sh

You can now test this from the command line
Code: [Select]
# /usr/bin/GetNetworkState.sh
172.16.42.22#

Note that it shouldn't give you a new line at the end.
« Last Edit: October 29, 2015, 06:44:41 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #3 on: November 08, 2015, 03:49:51 am »
AltUI:  v0.95.883
openLuup: 5.5
Chrome: Version 46.0.2490.80 m

I was hoping someone could confirm if their Sonos is exhibiting any issues.

Sonos device/player tab.
Code: [Select]
stack:TypeError: savedQueues.indexOf is not a function
    at Sonos_refreshPlayer (J_Sonos1.js:941:26)
    at Sonos_showPlayer (J_Sonos1.js:237:2)
    at eval (eval at _deviceDrawControlPanelJSTab (http://cobalt:3480/J_ALTUI_uimgr.js:4198:41), :1:1)
    at _deviceDrawControlPanelJSTab (http://cobalt:3480/J_ALTUI_uimgr.js:4198:17)
    at _deviceDrawControlPanelOneTabContent (http://cobalt:3480/J_ALTUI_uimgr.js:4573:7)
    at _displayActiveDeviceTab (http://cobalt:3480/J_ALTUI_uimgr.js:4599:4)
    at HTMLAnchorElement. (http://cobalt:3480/J_ALTUI_uimgr.js:6595:4)
    at HTMLDivElement.m.event.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:8549)
    at HTMLDivElement.r.handle (http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:5252)
    at Object.m.event.trigger (http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:7650)

openLuup log data.
Code: [Select]
2015-11-08 02:40:54.737   luup_log:36: Sonos: UPnP proxy event identified - API version
2015-11-08 02:40:54.895   openLuup.context_switch::  ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:54.895   luup.delay_callback:: function: 0x10f9000 ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:54.896   luup_log:37: Sonos: UPnP proxy event identified - API version
2015-11-08 02:40:55.048   openLuup.context_switch::  ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.048   luup.delay_callback:: function: 0x10ef0d0 ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.048   luup_log:38: Sonos: UPnP proxy event identified - API version
2015-11-08 02:40:55.222   openLuup.context_switch::  ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.222   luup.delay_callback:: function: 0x105ccb0 ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.223   luup_log:39: Sonos: UPnP proxy event identified - API version
2015-11-08 02:40:55.420   openLuup.context_switch::  ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.420   luup.delay_callback:: function: 0x15d2fd0 ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.420   luup_log:40: Sonos: UPnP proxy event identified - API version
2015-11-08 02:40:55.436   openLuup.context_switch::  ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
2015-11-08 02:40:55.436   luup.delay_callback:: function: 0x105f330 ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup: AV plugins
« Reply #4 on: November 08, 2015, 05:16:06 am »
I don't get this, but perhaps it's related to what's in the queue, or some previous action.

AltUI v0.95.880
Firefox 42.0

  • You're running 5 different Sonos systems? 
  • Are you running the Event Proxy?
  • Don't do that.

Line #947 in my version of L_Sonos1.lua is:
Code: [Select]
    if (ProxyApiVersion and tonumber(ProxyApiVersion:match("^(%d+)")) >= n) then
« Last Edit: November 08, 2015, 06:55:37 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #5 on: November 08, 2015, 11:00:40 am »
Thanks for moving this thread, kind of forgot about the AV plugin thread...
Yes, I had just added 5 speakers and for the most part one of them was working (displaying track and artist). I think It may have been coincidence I had just updated to .883. Hmm, event proxy - not sure I'd know if I was using it (inadvertently). I looked at debug > one devices states:

Code: [Select]
    {
      "id": 138,
      "service": "urn:micasaverde-com:serviceId:Sonos1",
      "value": "proxy is not in use",
      "variable": "ProxyUsed"
    },

But I'm not sure that's what you meant...

I don't get this, but perhaps it's related to what's in the queue, or some previous action.

AltUI v0.95.880
Firefox 42.0

  • You're running 5 different Sonos systems? 
  • Are you running the Event Proxy?
  • Don't do that.

Line #947 in my version of L_Sonos1.lua is:
Code: [Select]
    if (ProxyApiVersion and tonumber(ProxyApiVersion:match("^(%d+)")) >= n) then

Edit: OK, I did remove the UPNP Proxy from Vera as I was moving devices over, forgot (lets just say late night) I did that and forgot I had it installed remotely. I didn't install it locally though...
Will see if putting it back on Vera resolves anything...
« Last Edit: November 08, 2015, 11:09:58 am by CudaNet »
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup: AV plugins
« Reply #6 on: November 08, 2015, 11:10:21 am »
Hmm, event proxy - not sure I'd know if I was using it (inadvertently). I looked at debug > one devices states:

On the Settings page of the Sonos control panel, near the bottom:

UPnP event proxy:   proxy is not in use


---

Edit: I'm using 883 of AltUI now.
« Last Edit: November 08, 2015, 11:12:10 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #7 on: November 08, 2015, 11:24:21 am »
ok, it's definitely not on...

Hmm, event proxy - not sure I'd know if I was using it (inadvertently). I looked at debug > one devices states:

On the Settings page of the Sonos control panel, near the bottom:

UPnP event proxy:   proxy is not in use


---

Edit: I'm using 883 of AltUI now.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #8 on: November 08, 2015, 11:30:44 am »
I'm going to clean off the rPi and test just adding a speaker to it and see what happens.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup: AV plugins
« Reply #9 on: November 08, 2015, 11:31:45 am »
I'm going to clean off the rPi and test just adding a speaker to it and see what happens.

Good plan!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #10 on: November 08, 2015, 11:49:59 am »
Well it seems to work on the rPi (one speaker) but speech isn't working.. Going to backup my production system and then see if I can add all my speakers, if that works then start slowly adding other devices to see what may be in contention.

Code: [Select]
2015-11-08 10:46:59.272   openLuup.server:: /data_request?id=lu_action&output_format=xml&DeviceNum=36&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&Text=testing&Language=en&Engine=OSX_TTS_SERVER&Volume=20&GroupZones=&SameVolumeForAll=false tcp{client}: 0x12d4368
2015-11-08 10:46:59.274   luup.call_action:: 36.urn:micasaverde-com:serviceId:Sonos1.Say
2015-11-08 10:46:59.312   openLuup.context_switch::  ERROR: ./L_SonosTTS.lua:144: attempt to index local 'fh' (a nil value)
2015-11-08 10:46:59.314   openLuup.server:: request completed (2 bytes, 1 chunks, 41 ms) tcp{client}: 0x12d4368

Edit... Well I should have peeked at the console window. I don't actually see it creating the file so hard to say what's happening...
I know for the Nest I had to add a param to force (-f) removal so it would stop prompting and holding up the UI and openLuup.

Code: [Select]
rm: cannot remove ?/www/Say.36.mp3?: No such file or directory
/www/Say.36.mp3: Permission denied


I'm going to clean off the rPi and test just adding a speaker to it and see what happens.

Good plan!
« Last Edit: November 08, 2015, 12:25:37 pm by CudaNet »
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #11 on: November 08, 2015, 12:36:19 pm »
Seems if I place a fake Say.36.mp3 file within the /www directory it's able to remove the file which leads me to believe it's not creating the file. I know, I'm jumping from issue to issue so I'll just focus on the Sonos devices playing music and look at the TTS later.

Code: [Select]
2015-11-08 11:30:48.408   openLuup.server:: /data_request?id=lu_action&output_format=xml&DeviceNum=36&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&Text=Testing%20the%20server&Language=en&Engine=OSX_TTS_SERVER&Volume=&GroupZones=&SameVolumeForAll=false tcp{client}: 0x13d2c98
2015-11-08 11:30:48.410   luup.call_action:: 36.urn:micasaverde-com:serviceId:Sonos1.Say
2015-11-08 11:30:48.447   luup_log:36: Sonos: warning: TTS server (ODX): failed!
2015-11-08 11:30:48.462   openLuup.server:: request completed (101 bytes, 1 chunks, 54 ms) tcp{client}: 0x13d2c98
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup: AV plugins
« Reply #12 on: November 08, 2015, 12:40:22 pm »
Edit... Well I should have peeked at the console window. I don't actually see it creating the file so hard to say what's happening...
I know for the Nest I had to add a param to force (-f) removal so it would stop prompting and holding up the UI and openLuup.

Code: [Select]
rm: cannot remove ?/www/Say.36.mp3?: No such file or directory
/www/Say.36.mp3: Permission denied

Yes, I saw this a lot originally - I don't use TTS ordinarily, so it may still be there.

Another example of a plugin using os.execute "rm ..." when it should be using os.remove "..."

Didn't stop TTS from working, though, I recall.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup: AV plugins
« Reply #13 on: November 08, 2015, 01:27:10 pm »
Well, if I create the Sonos device on the Raspberry Pi (Ubuntu Mate) - it works. If I move the user_data.json file over to the Ubuntu server, it works for a little while then starts to error. Starting clean on the Ubuntu server, I start off with errors. Not sure what's going on with this...

Code: [Select]
2015-11-08 12:24:09.275   openLuup.server:: /data_request?id=lu_action&output_format=xml&DeviceNum=5&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=SelectSonosDevice&URL=http%3A%2F%2F10.0.4.20%3A1400%2Fxml%2Fdevice_description.xml tcp{client}: 0x1f28878
2015-11-08 12:24:09.275   luup.call_action:: 5.urn:micasaverde-com:serviceId:Sonos1.SelectSonosDevice
2015-11-08 12:24:09.280   luup.attr_set:5: 5.ip = 10.0.4.20
2015-11-08 12:24:09.280   luup.attr_set:5: 5.mac =
2015-11-08 12:24:09.313   openLuup.context_switch::  ERROR: ./L_Sonos1.lua:947: attempt to compare number with nil
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup: AV plugins
« Reply #14 on: November 08, 2015, 01:38:29 pm »
Ah, I think I may know what that might be.  Can you set the MAC address to a space rather than nothing?
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.