Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MrGlasspoole

Pages: [1]
1
Other Plugins / TCP CPython communication
« on: November 10, 2014, 04:23:00 AM »
Hi,

I'm having some problems with IronPython so i want to use CPython.
The idea is to let VC communicate through TCP with CPython.

From a webpage i can send "VC.On\r\n" and in VC i see "VC.ON:" but VC does not turn into green.
Is there more i need to do?

The other question is how to i send from VC if TCP is running as server and not as client?
I think it must be possible cause in my CMD window i receive "OK" after sending the command above - so VC is sending back!?

Notes:
The whole setup is a little more complicated cause i'm using MQTT and Websockets.
But seeing "VC.ON:" in VC means the CPython asynchat/asyncore <-> VC TCP connection works.

2
Python Scripting / Re: CPython and Python Packages in IronPython?
« on: September 13, 2014, 03:04:48 PM »
Maybe it is not compatible with IronPython.  I don't know.  You should do some searches
Thats what i always do before asking - I search for hours ;)

Great.  Why don't you just do that then?
Cause i don't know how to call a function inside my CPython file if i use the VC Launch action.
I think normally i have this CPython script running all the time (it must cause the MQTT-Client needs to listen for incoming messages) . Then from outside i call a function that i have defined inside that script.

It looks like you are just accessing your ZoomPlayer through HTTP get requests.  You can do this using the Scrape action in VC.
Actually I guess it is using TCP.
Yes it's TCP (cause i can't figure out Win32 API).
From Server to HTPC i send the command (5100 fnPlay) with MQTT.
On the HTPC is just a small Python script (MQTT-Client) listening and then opens a socket to ZoomPlayer
and passing this command to it.
But now i know there is a "Scrape action" and i will check it out :)
Maybe i can read WebSocket streams with it...

You code compiles but I don't have zoomplayer so I don't know if it actually works.
Hm, if i execute:
Code: [Select]
import sys
import paho.mqtt.publish as publish

publish.single("home/Johnny-Five/ZoomPlayer", "5100 fnPlay", client_id="Gem", hostname="localhost")
I always get:
Quote
Line: 722 >>
TypeError: create_connection() got an unexpected keyword argument 'source_address'
in the Log

3
Python Scripting / Re: CPython and Python Packages in IronPython?
« on: September 13, 2014, 12:50:02 PM »
If you want to use your python files with "other programs" (I'm not exactly sure what you mean by this), then just use CPython.
Lets say i have i Python script that does something (sure it does something *lol) and i want to run it from VC and also from outside.
I mean you don't want to write the same code twice - one for VC and one for something else.
Hm, example? Ok, maybe i have a Python script that switches an some lamp (arduino+relay) and i want to run it from VC but also from a website.

So you can't call actions and events in VC from the python code, or pass variables between VC and python.  But you can call executables along with command line parameters by using the Launch actions in VC, so if you create a program in CPython you can initiate it from VC, and you may also be able to read console information back from it.
Whats the difference between i "can't call actions and events" but i can "call executables with command line parameters and read console information back from it"?
For example: You can get information from ZoomPlayer like "filename of playing file" or "runtime".
I know (with my yet little Python knowledge) how to do it in CPython.
If i write that in CPython and know want to get this information from VC if i say: tell me filename.

I don't know what you mean by "register VC IronPhyton in my system (environment variables)" or why you would need to do this.
Normally you register Python in Windows under the "environment variables" that you can run Python stuff without the need to always write the whole path or calling Python first:
https://docs.python.org/2/using/windows.html#finding-the-python-executable
Step 2: http://www.aaronstannard.com/post/2012/08/17/How-to-Setup-a-Proper-Python-Environment-on-Windows.aspx

The error:
I try to get MQTT running with IronPython: https://pypi.python.org/pypi/paho-mqtt
I do everything with MQTT - switching/dimming lights, control ZoomPlayer, read temps, open/close doors...
Thats what MQTT is made for and is the coolest thing of the Internet of things :)

Sure i can call my CPython script from VC with Launch.Hidden py\test.py
Code: [Select]
import sys
import paho.mqtt.publish as publish

publish.single("home/Johnny-Five/ZoomPlayer", "5100 fnPlay", client_id="Gem", hostname="localhost")
This is play/pause and works with ZoomPlayer running on Johnny-Five (my HTPC).

If i run this in the IronPython Plugin tester i get that error - so Paho-MQTT does not work in IronPython.

But lets say i do this in CPython:
Code: [Select]
import sys
import paho.mqtt.publish as publish

def ZoomPlayer_play():
   publish.single("home/Johnny-Five/ZoomPlayer", "5100 fnPlay", client_id="Gem", hostname="localhost")
How do i call/run "ZoomPlayer_play" from VC?

4
Python Scripting / CPython and Python Packages in IronPython?
« on: September 13, 2014, 06:37:59 AM »
Hi,

Python is relatively new to me and i have some questions.
Is it possible to use CPython instead of IronPython or is it to much linked with VC?

The problem is that i want to also use my Python files with other programs.
Then it looks like there are Python packages that don't work with IronPython.

If i can't use CPython the same way and with the same VC functions/features like with IronPython,
how to i register VC IronPhyton in my system (environment variables)?

Then I'm not sure how to ad packages to the VC IronPython.
The normal way is putting them in the "site-packages" folder but that did not work.
I did put it in PY/Lib and that looks like the import works - but the my code gives me:
Code: [Select]
Line: 722 >>
TypeError: create_connection() got an unexpected keyword argument 'source_address'
In CPython my code works...

Also I'm not sure what part of the unziped package is the right one to put in IronPython.
There is the main folder with the setup.py...
There are subfolders "build" and "src"...
Build has a subfolder "lib"...

5
General Discussion / VoxCommando vs Links
« on: September 11, 2014, 04:51:45 AM »
Hi,

i found VoxCommando and I'm testing it and when i was looking at youtube i stumble over
Jarvis what is now called Links or "Mega Voice Command".

I cant find a comparison between VoxCommando and Links.
Can somebody shine some light on me where the technical difference is (speech recognition engine)?

Pages: [1]