New Plugin - XBMCState - Xbmc addon

Good thing that i have a little break today. The problem was my fault, i test the debouncing only on the video and mistype a line in the code for the music, when i say your log, i didn’t put the float function before the audio denouncing. Sorry. Here in the attachement the version with the right code in it, also add notification that say to put your ip address in it and say start plugin. Could be disable in the addon setting to if you find that annoying. Let me know if it work good, for me it ok on window and mac. If so i will release this version in the first post of the topic.

Sorry again

Hey mic,

Not your fault!!! - you made the plugin!! ; can’t be better than that!!! - respect!

Works perfect (from my limited testing!!!); but at boot up (assuming because the network connection isn’t ready); which the debug log suggests:
0:00:51 T:2951443552 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script retur$
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class ‘urllib2.URLError’>
Error Contents: <urlopen error [Errno 101] Network is unreac$
Traceback (most recent call last):
File “/storage/.xbmc/addons/micasaverde.addon/default.py”,$
player=MyPlayer()
File “/storage/.xbmc/addons/micasaverde.addon/default.py”,$
urllib2.urlopen('http://%s:3480/data_request?id=variable$
File “./Lib/urllib2.py”, line 126, in urlopen
File “./Lib/urllib2.py”, line 400, in open
File “./Lib/urllib2.py”, line 418, in _open
File “./Lib/urllib2.py”, line 378, in _call_chain
File “./Lib/urllib2.py”, line 1207, in http_open
File “./Lib/urllib2.py”, line 1177, in do_open
URLError: <urlopen error [Errno 101] Network is unreachable>
–>End of Python script error report<–

Can you add a ‘stall’ or ‘wait’ for the network to be reachable? ; raspberry needs time ! ::slight_smile:

Top stuff!

Nice to see that it working. Could you desactivate the (xbmc on) event and restart the xbmc. You probably right, if you don’t use the home menu event the only url that is send when start is the on event. If you don’t have any error after that, will check to put a wait on the xbmc on and home, Not sure how to do it but will probably be easy.

Hello Mic, great job on the plugin! Would it be possible to integrate WOL with the Vera side of the plugin?

This would allow me to turn on my XBMC box right from Vera without using a separate plugin. May I suggest looking at the WOL Plus Ping plugin for reference, maybe garrettwp would allow you to use some of his code to integrate with your XBMCState plugin.

Thanks again for a very useful plugin.

Hey mic!

Can confirm it is just the xbmcstate up acknowledgement that causes the issue. If I disable that my xbmc.log is clean - no errors!!
This is such a great add-on!!!
I do hope you add communication the other way i.e. vera controls xbmc - that allows for some very interesting stuff to happen as they can talk too each other!!
Keep up the great work!!

Much appreciated!

EDIT:
Yes I want to catch the shutdown menu (i.e. menu’s up but no selection made). Then I can get verde via XBMCState too ‘see’ this event and therefore get my itach box to turn the TV off. Equally selecting music/movie etc. causes the TV to come on. Not sure how to get verde not to keep sensing ‘tv on’ multiple times - i.e. if you choose a movie and then another for example… :slight_smile:

[quote=“pocster”]Hey mic!

Can confirm it is just the xbmcstate up acknowledgement that causes the issue. If I disable that my xbmc.log is clean - no errors!!
This is such a great add-on!!!
I do hope you add communication the other way i.e. vera controls xbmc - that allows for some very interesting stuff to happen as they can talk too each other!!
Keep up the great work!!

Much appreciated!

EDIT:
Yes I want to catch the shutdown menu (i.e. menu’s up but no selection made). Then I can get verde via XBMCState too ‘see’ this event and therefore get my itach box to turn the TV off. Equally selecting music/movie etc. causes the TV to come on. Not sure how to get verde not to keep sensing ‘tv on’ multiple times - i.e. if you choose a movie and then another for example… :-)[/quote]
Two questions as I’m curious to know
1.why would you want to turn off the TV before selecting how to shutdown XBMC
2. Why does you TV turn on when selecting music/movie?
Are you aware that there is XBMC opened and closed functions …why are these not suitable for triggers to turn on/off your TV?

Sent from my ASUS Transformer Pad TF300TG using Tapatalk HD

@Jmedemar
Will take a look on it. Thanks

I also check for your problem pocster, a good idea in the starting of the plugin to check if connection to vera have been made if not stay there until communication done. It will also avoid some script error when ip is not properly set. Will check on this.

Thanks

@Mic
Thanks!!
Could you add whether live tv has been selected and therefore a ‘live tv’ channel?

@baxy_AU
My XBMC unit never shuts down because its live tv,pvr,music streamer - so always on

BUT! ; I wish the TV to turn on/off. The only reason I can see to turn the tv on is because you have selected live tv/play audio/watch movie via an xbmc controller on an ipad etc.

Please explain the XBMC open/close functions? . The real problem is that the remote controller (as I said XBMC commander or constellation etc.) has to support these functions - currently they don’t. Hence turning a TV on not an issue ; turning it off more tricky i.e. what 'button/option in XBMC constellation/commander can I use for that???)

There may be a better solution to this problem!!

Cheers

I suppose I could do a simple bodge :o
As I have to have a high WAF (Wife Approval Factor) for now I could use an appliance switch as a TV on/off i.e. verde reads that to trigger the gc100 so nothing to do with XBMC controller or XBMCState. It’s a bit lame but when women (sorry only MY wife) have more than 1 remote or multiple buttons the WAF drops drastically.
Again; was simply trying to think of a way commander/constellation could trigger something in XBMC that XBMCState could then report to Verde to power off/on tv appropriately.

ANY suggestions welcome (presumably involving XBMCState as this is it’s thread) ;D

@Pocster
One thing that you could do is if you don’t use the weather or the picture menu, for the momment use it as to trigger your tv to off. That is if you dont use this menu.

Hey Mic,

I thought of that ;D ; problem is xvmc constellation doesn’t have a ‘weather’ icon. So you’d have to drop back to the standard xbmc menu ; scroll across to weather and then select it. The real issue is that constellation/commander don’t have any programmable buttons that you can assign a function too. :-\

Not today but i will put a windows id programable event. You will be able to chose the windows id that you want to trigger.i post a link of the list of the windows id in previous post if you want to take a look. Will come back with the update soon.

Thanks Mic,

That’s certainly the most flexible approach for now.
If this also allows ‘live TV’ to be a trigger as you have with audio start/end, video start/end that would really help!!

Cheers

Will check if i work good and maybe add more then on custom event

Have been able to add 2 custom event for the menu id. It seems that xbmc does not show all the windows id but the principal is there. So if the windows id menu is trigger by xbmc, plugin will catch it. I try with the add-on setting menu and it work like a charm. So it up to you to try the windows id and check if addon response to it. A good trick is to put the debug mode on and check the log file, it will show you the windows that have been activate when xbmc was running and the id. Didn’t have time to zip it to be publish but will do it in short time. If you guy test it and seems to work good, i will also update the micasaverde plugin to add trigger for event_1 and event_2.

Here a small youtube video that demonstrate what i done with the xbmc state:

I also love arduino so i make a led server that the vera could control the color and map it with some scene with the xbmc plugin.
Here the tread for the arduino if some of you guy’s are interest.
http://forum.micasaverde.com/index.php/topic,13486.0.html

Know that is off topic but just for information, with this code your able to control led strip, 9 relay monitor doorbell and phone ring and this week i’ve been able to add cheap wireless doorsensor from ebay (7$ each) They work like a charm and the range is pretty good. I also receive rfid (14 box) Did not have time for it but will make it work for sure with the vera to.

Oooooo looks nice!

Tell me more about the rfid and how they work and (too kepp on topic - or perhaps start a new thread??) with verde.

Cheers!

Thanks
Just follows the tread has mention in my previous post, i post the code for the led server and more. For the rfid i received it but didn’t have time to play with it it cost around 14$ on ebay and come with 2 credit card and a key tag. When got time to play with it i will post in the other tread.

This is a great add-on. It is working perfect when I’m watching a movie in XBMC. When I’m watching Hulu, it turns the lights back on and then off again very quickly at the commercial spots in the video stream, so on/off at each commercial break, and then on/off again when the show starts again.

I looked around briefly for an LUUP function I could use to have it check for a condition in addition to to luup.is_night() to have those breaks in the video stream be ignored, but I’m new at LUUP and am not familiar with the available functions. Is there a function that exists for this?

If you check in the addon setting i put a debounce for this problem, just put 1 seconds on the video debouncing restart xbmc and you should be good. Let me know