Announcement

Collapse
No announcement yet.

ZEE - VB script to run python

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ZEE - VB script to run python

    Hello everyone,

    I am new to HomeSeer and just joined this forum.

    I have a Troller ZEE and a PiFace and I am trying to control the PiFace through the HS3. ZEE only accepts VB.NET scripts and I am controlling the Piface using python. I am not a programmer, never used VB.NET but I know some python. Is there a way to call a python script using VB.NET under HS3?
    Does anyone has a sample script that I can use - whatever I have tried did not work for me

    Thank you,

    #2
    ZEE - running a python script

    on the same topic ...
    It looks like, in the Event section, there is an option to "Run Another Program or Process" but when pointing to "/usr/bin/python3", I get an error "\usr\bin\python3 cannot be found"... it looks like the slashes are replaced by back-slashes. Is there a special way of using this option? Can I use it to run python scripts?

    Comment


      #3
      Been testing / trying to install IronPython. Tried the build thing this morning:

      git clone git://github.com/IronLanguages/main.git IronLanguages
      xbuild Solutions/IronPython.sln /p:Configuration=Release
      root@ICS-HS3-Zee:~/IronLanguages# xbuild Solutions/IronPython.sln /p:Configuration=Release
      XBuild Engine Version 2.10.8.1
      Mono, Version 2.10.8.1
      Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.

      Build started 11/02/2014 07:33:55.

      $YOUR_INSTALLATION_PATH/IronLanguages/bin/Release
      export IRONPYTHONPATH= $IRON_LANGUAGES_INSTALLATION_PATH/IronLanguages/External.LCA_RESTRICTED/Languages/IronPython/27/Lib:$IRONPYTHONPATH
      mono ipy.exe
      I have an issue:

      root@ICS-HS3-Zee:~/IronLanguages/bin/Release# mono ipy.exe
      Traceback (most recent call last):
      File "/root/IronLanguages/bin/Release/Lib/site.py", line 62, in <module>
      ImportError: No module named osIronPython 2.9.9a0 (2.9.0.0) on Mono 4.0.30319.1 (32-bit)
      Type "help", "copyright", "credits" or "license" for more information.
      >>>
      Found that I needed to do:

      export IRONPYTHONPATH=/root/IronLanguages/Release/External.LCA_RESTRICTED/Languages/IronPython/27/Lib:$IRONPYTHONPATH
      Added these two lines to bashrc

      export IRONPYTHONPATH=/root/IronLanguages/Release/External.LCA_RESTRICTED/Languages/IronPython/27/Lib:$IRONPYTHONPATH
      alias ipy='”mono $IRONPYTHON /root/IronLanguages/bin/Release/ipy.exe"'
      Last edited by Pete; February 11, 2014, 09:55 AM.
      - Pete

      Auto mator
      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
      Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
      HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
      Fanless Intel® Celeron N3160 SoC 8Gb
      HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
      HSTouch on Intel tabletop tablets

      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

      Comment


        #4
        thanks Pete
        this is an interesting option - I will try it - but this is good if you want to integrate python with .NET. In my case I was just trying to see if I can trigger a program (python in this case because i have more experience with it) from the HS3.
        The "Run Another Program or Process" looks to be what I need but I do not understand why does not work .. an the help files do not give too much info...

        Comment


          #5
          Yup; for Mono you have to incorporate the use of IronPython for dot net stuff then call it when using it in a script.

          http://www.mono-project.com/Python

          IE: once IronPython is installed then you can just run your Python script from the external program call in Homeseer 3.
          Last edited by Pete; February 11, 2014, 10:23 AM.
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
          Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
          HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
          Fanless Intel® Celeron N3160 SoC 8Gb
          HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
          HSTouch on Intel tabletop tablets

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

          Comment


            #6
            Originally posted by Pete View Post
            Yup; for Mono you have to incorporate the use of IronPython for dot net stuff then call it when using it in a script.

            http://www.mono-project.com/Python

            IE: once IronPython is installed then you can just run your Python script from the external program call in Homeseer 3.
            Ok - it took me a bit to install and properly setup the IromPython but now looks like is working.
            Now - how to call a python script from within the HS is another problem do you have a sample script that you can share

            thanks,

            Comment


              #7
              I haven't played with python on HS3.

              That said give it a try now. Create a simple python script and put it in your script directory.

              call it "test.py". See if this works.

              I just tried.

              It doesn't. When I select a script its not seeing the "test.py" script in the directory; just sees vb or txt files.

              def Main():
              hs.WriteLog("Debug","Hello HomeSeer from IronPython!"
              I just manually entered it and this is what I see when I run it. I wonder if we can open up a bugzilla ticket for this?

              Feb-12 10:22:38 AM Event Event Python Test triggered by the event page 'Run' button.
              Feb-12 10:22:38 AM Event Event Trigger "Python Test"
              Feb-12 10:22:38 AM Event Running script in background: /usr/local/HomeSeer/scripts/test.py
              Feb-12 10:22:38 AM Error Cannot run .txt script on Linux, only .vb scripts are supported
              Running it with external commands just gives me an error that it cannot find the file.

              Playing some more now.

              Interesting reading....as the choice for Homeseer in the HS2 world was ActivePython which came for free but was offered by a private company.

              Not sure where to go with this as doing a google search on the use of Mono and Python leads to IronPython and not much else these days.
              Last edited by Pete; February 13, 2014, 09:43 AM.
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
              Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
              HS4 Lite - Ubuntu 20.04 / VB W7e Jetway JBC420U591
              Fanless Intel® Celeron N3160 SoC 8Gb
              HS4 Pro - V4.1.18.1 - Ubuntu 20.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb
              HSTouch on Intel tabletop tablets

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

              Comment

              Working...
              X