We have moved at community.getvera.com

Author Topic: New Plugin - XBMCState - Xbmc addon  (Read 129181 times)

Offline Mic

  • Full Member
  • ***
  • Posts: 245
  • Karma: +1/-0
New Plugin - XBMCState - Xbmc addon
« on: February 16, 2013, 04:45:03 pm »
Hi,
    here the new topic for the XBMCState plugin. Due to the change of the owner, it better to start a fresh topic with all the good information.

Instruction:
1-Install the XBMCState plugin from the mios app store (take note of your vera IP and XBMCState device ID)
2- Install the xbmc addon from the zip file below. (If you use safari, be careful cause it automatically unzip the file and xbmc give some error to install it)
3- Go to the addon setting and put the vera IP, xbmcstate device ID, put yes to all the event that you are interested in.
4-RESTART XBMC. When you change the ip address and id device you absolutely have to restart xbmc to take affect.
6-Try it out.

For now these event are triggered:
Music started
Video Started
Music paused
Video paused
Music resumed
Video resumed
Music stopped
Video stopped
Music ended
Video ended
Home menu
Video menu
Music menu
Weather menu
Setting menu
Program menu
Picture Menu

Music and video title of the file that is actually played is also showed.

There also now a debug mode that show what is send to vera in the log file if activate.


Edit on 14 march 2013:

Add debounce function for the video and music.
Add custom menu.
Add notification when plugin start (can be remove in the addon setting.)

Tested on Frodo

Windows 7  = OK
Windows 8  = OK
Linux          = OK
Mac            = OK
Raspberry   = OK
OpenElec    =OK


edit on 17 February 2014:

Adjust add-on to be compatible with Gotham.
« Last Edit: February 17, 2014, 10:41:40 am by Mic »

Offline Thomasss

  • Full Member
  • ***
  • Posts: 121
  • Karma: +0/-0
Re: New Plugin - XBMCState - Xbmc addon
« Reply #1 on: February 16, 2013, 04:56:31 pm »
Mmmiam... Cool to see things progressing... When I get my Vera it was my first though to have a XBMC plugin.
I've tried to build a plug-in but is was way over may coding abilities...
the best I can do is trying to give good feedback. So tomorow, I will reinstall XBMC on an old laptop and try this.

Thanks for your work and have a nice WE.

Offline Aaron

  • Hero Member
  • *****
  • Posts: 1985
  • Karma: +61/-193
Re: New Plugin - XBMCState - Xbmc addon
« Reply #2 on: February 16, 2013, 06:32:54 pm »
Mic,
Nice work.
One admin suggestion... keep a changelog in post #1 and name the posted file with the version # so it simply takes a quick glance to see if we are up to date, and what has changed? I'm happy to test new version but I don't want to keep asking, or guessing ;)

also, in XBMC there is a naming structure for addons. Yours should be named: script.micasaverde  - or similar.

see the guide here...
http://wiki.xbmc.org/index.php?title=Add-on_development


« Last Edit: February 16, 2013, 06:44:23 pm by Aaron »

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: New Plugin - XBMCState - Xbmc addon
« Reply #3 on: February 16, 2013, 06:44:06 pm »
This is extremely cool and perfect timing as I am in the middle of a migration from MCE to XBMC and I am really going to miss the mControl Home Automation add-on for MCE and Vera control.

I just installed the XBMCState Vera add-on and the XBMC add-on. In the XBMC add-on I entered the IP of my VeraLite and the device number of the XBMCState device in Vera which is #53.

In Vera it was asking me to enter an IP in Advanced settings, I presume this is the IP address of the XBMC PC.

Presume I can create more instances of XBMCState devices for multiple XBMC PCs?

In the XBMC add-on under player state I set to yes Music - Paused / Started / Stopped. I then restarted XBMC application.

Looking at the XBMCState Device in VeraLite it says Ping status: UP

If I start playing an Album the XBMCState device in Vera says Play State - Audio Started if I pause the music it says Audio Paused, so seems to be working.

Now ideally Id like to use this to dim and brighten my lamps in the lounge when I play and pause movies. How do I do this? Do I use the XBMCState device as a trigger on one of my lighting scenes?

Also we would need some kind of control over when this happens, obviously we don't want lights coming on during the day when watching movies.

Many thanks

Stuart.




Offline Mic

  • Full Member
  • ***
  • Posts: 245
  • Karma: +1/-0
Re: New Plugin - XBMCState - Xbmc addon
« Reply #4 on: February 16, 2013, 06:49:25 pm »
Yes, you're right, when releasing next version, will make a number in the zip file. I'm like you i hate to follow all the topic to see every version that have been release. So when something new will be released, it will be edited in the first post with the change log and the new download. That also why i started a new topic. Did you test it Aaron?

Thanks

Offline Mic

  • Full Member
  • ***
  • Posts: 245
  • Karma: +1/-0
Re: New Plugin - XBMCState - Xbmc addon
« Reply #5 on: February 16, 2013, 06:59:39 pm »
Glad to see it working @cw-kid. In the vera plugin, i had all the trigger that xbmc send so, for me, i have make a scene named:
 Xbmc led tele
And in the scene, i put a trigger of each event that i want. (go in the trigger tab, add xbmcstate and chose the one that you want)
When the trigger is created, there's luup code at the right of the created trigger.
Just put the luup code that you want. For sure you could put more trigger and use diffirent luup code for each trigger.
If you are not familiar with luup code , this help me a lot when i started:
http://wiki.micasaverde.com/index.php/Luup_Scenes_Events
Check, there are a code for (if the it's the night, do it or not).
Let me know if you have some difficulty.

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: New Plugin - XBMCState - Xbmc addon
« Reply #6 on: February 16, 2013, 07:08:26 pm »
Here's what I did so far, I created a second XBMCState Device instance for my Linux / XBMC PC that is actually connected to my TV.
Device ID = #54. Setup the XBMC add-on again and checked the status changes in Vera for the XBMCState device which indeed it does.

I then edited one of my existing scenes - Lounge On which turns the lights on 100% added a trigger as shown in the screen shot. But when I pause the lights do not brighten up to 100%.

I will look at this properly tomorrow as its late here now and I've had a few beers  :P

Offline Mic

  • Full Member
  • ***
  • Posts: 245
  • Karma: +1/-0
Re: New Plugin - XBMCState - Xbmc addon
« Reply #7 on: February 16, 2013, 07:49:54 pm »
It seems that you have the old vera plugin, you should not. Strange cause i upload the new one. The old one didn't care about the music or video playback so that why it does not work. Sorry about that. I check that right now.


Offline Mic

  • Full Member
  • ***
  • Posts: 245
  • Karma: +1/-0
Re: New Plugin - XBMCState - Xbmc addon
« Reply #8 on: February 16, 2013, 08:00:47 pm »
It's the first time that i try to upload code to the mios app. If you want to try it tonight, here the link of the file that you need to upload in the app developer tab:
just upload it in your vera and trigger should now appear with the music menu and video option. I will check and comeback to you when update will be passed.

Sorry again

EDIT: link from dropbox have been remove, it seems like dropbox make the json file a html file.
Use the link below.
« Last Edit: February 17, 2013, 08:38:52 am by Mic »

Offline Mic

  • Full Member
  • ***
  • Posts: 245
  • Karma: +1/-0
Re: New Plugin - XBMCState - Xbmc addon
« Reply #9 on: February 16, 2013, 08:20:00 pm »
Change is in the hand of micasaverde. Need to wait the approval before releasing it. My fault sorry. Like i say in the previous post, if you don't want to wait, just upload the file with the link to your vera.

Thanks 

Offline conchordian

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +4/-1
Re: New Plugin - XBMCState - Xbmc addon
« Reply #10 on: February 17, 2013, 01:38:08 am »
Also we would need some kind of control over when this happens, obviously we don't want lights coming on during the day when watching movies.

http://forum.micasaverde.com/index.php/topic,13249.msg101278.html#msg101278 has the code for that.

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: New Plugin - XBMCState - Xbmc addon
« Reply #11 on: February 17, 2013, 06:03:04 am »
Thanks for the replies!

I uploaded the new Json file to Vera. I was then checking the settings in XBMC on my Windows Laptop and accidently clicked the Defaults button which wiped out all the settings in the XBMC add-on. I entered the Vera IP and Device ID again etc in XBMC.

Now when looking at the XBMC-Laptop device in Vera it looks like the screen shot below, is this correct?

The icon has gone and so has the Ping / Play state etc.

Thanks

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: New Plugin - XBMCState - Xbmc addon
« Reply #12 on: February 17, 2013, 06:15:32 am »
I just turned on the Linux XBMC PC and reloaded Vera and that device has changed as well so presume this is expected. Will try some triggers next.

Thanks

EDIT: Neither XBMC-State device is listed now in trigger devices you can select. For example the Linux XBMC PC device in Vera I assigned to the Living Room. But if you look at the screen shot I cant see the XBMC device to select as a trigger.

« Last Edit: February 17, 2013, 06:28:44 am by cw-kid »

Offline chixxi

  • Hero Member
  • *****
  • Posts: 1036
  • Karma: +37/-14
Re: New Plugin - XBMCState - Xbmc addon
« Reply #13 on: February 17, 2013, 07:14:17 am »
I can confirm what cw-kid is posting. To me this looks like errors in the *.json file, therefore there are no objects in the UI and no events...
Developer of Plugins: Virtual Switch, Variable Container, Popcorn Hour Remote, Vacation Ghost. => PLUGINS HAVE BEEN UNPUBLISHED BY ME.

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: New Plugin - XBMCState - Xbmc addon
« Reply #14 on: February 17, 2013, 07:21:39 am »
I can confirm what cw-kid is posting. To me this looks like errors in the *.json file, therefore there are no objects in the UI and no events...

Well least its not just me! When this is all working I am going to write a how-to guide on my blogs.

The Digital Lifestyle
The Media Center Blog