• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. cimba007
    3. Posts
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 10
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: abnormal heatrbeat frequency

      @Daniele Could you provide your sourcecode? in Response to every smartSleep the controller sends a heartbeat as response. (at least i think so)

      posted in Troubleshooting
      C
      cimba007
    • RE: Telegram notification

      I have currently doployed a workaround:

      • For every sensor there is a rule to fire when an event occurs
      • For every rule there is one operation
      • Each operation calls the same script with different Script bindings

      There are still several timers to enable/disable the operation(s)

      Latest telegram_min.py (https://pastebin.com/2BfqnmU3)
      Latest telegrom_bot.py (scriopt for mycontroller):

      import commands
      if picture is not None:
         commands.getstatusoutput('/usr/bin/python /home/pi/mqtt/telegram_min.py -i CHAT_ID -m "' + message + ' " -p "' + picture + '" ' )
         commands = None
      else:
         commands.getstatusoutput('/usr/bin/python /home/pi/mqtt/telegram_min.py -i CHAT_ID  -m "' + message + '" ')
         commands = None
      

      With this solution I am able to send pictures too!

      posted in Developers Zone
      C
      cimba007
    • Telegram notification

      Hello,

      as I am currently out of pushes on pushbullet .. I tried to implement Telegram-API with Telegram-Bot via python and scripting.

      • Step 1: Download jython-standalone from http://www.jython.org/downloads.html
      • Step 2: Place under /home/pi/mycontroller/lib/jython-standalone-2.7.0.jar
      • Step 3: Install "pip install python-telegram-bot" on your raspberrypi
      • Step 4: Sign up on Telegram (Android)
      • Step 5: Register your bot with Botfather (https://core.telegram.org/bots#)
      • Step 6: After registering with Botfather you get an API-Key (further here described as APIKEY)
      • Step 7: Place a file telegram_min.py anywhere (https://pastebin.com/v6gZJqEp) and replace APIKEY
      • Step 8: Go to the chat_id bot mentioned here (https://stackoverflow.com/a/37396871). You need the CHAT_ID for your account.
      • Step 9: Create a mycontroller-python-script under "Utilitys->Script". As I have no idea how to install python-telegram-bot with jython I got a workaround.
      import commands
      commands.getstatusoutput('/usr/bin/python /home/pi/mqtt/telegram_min.py -i **CHAT_ID** -m '+message+'Test')
      commands = None
      

      This is how far I got .. if I manually run the script manually with the binding:

      {"message":"Test1234"}
      

      I get following message on my Telegram Desktop client:

      0_1508534653162_86c91fbf-7d5f-44bd-8f40-89bf6b6981a1-image.png

      This is good so far!!!

      But now I need your help @jkandasa

      What I want to do ..

      • Depending on a sensor value a rule should be triggered
      • The rule will trigger an operation

      My problem is now, that I only can define a script-binding on the operation that is no related to the rule-paraeters.

      0_1508534816665_384f4a80-7e4e-4408-871b-dc2bb2493865-image.png

      In the script or binding I would like to use

      0_1508534964152_3938616e-422d-4a38-9a8b-778ba2845579-image.png

      Currently I dont know how to use them in jython-script .. any idea?

      I tried to use notification-varaible but it does not work:

      2017-10-20 23:34:28,096 ERROR [Thread-6] [org.mycontroller.standalone.operation.model.OperationExecuteScript:133] Exception on McScript(engineName=null, mimeType=null, extension=py, name=/home/pi/mycontroller/conf/resources/scripts/operations/telegram_bot.py, canonicalPath=null, type=OPERATION, size=0, lastModified=0, bindings={message=Test})
      javax.script.ScriptException: NameError: name 'notification' is not defined in <script> at line number 2
      

      I would like to use this on binding:

      {"message":${notification.actualValue}}
      
      posted in Developers Zone
      C
      cimba007
    • Resources/Rules - Trigger on value changed

      Currently I implement a rule this way:

      0_1508016366456_743732c5-5bbf-4619-9141-5cec61b59eac-image.png

      The condition is always satisfied and "Ignore duplicates" is enabled.

      @jkandasa Is this the right way to implement a "on value changed" rule?

      posted in Developers Zone
      C
      cimba007
    • RE: How to enable a SSL certificate?

      This is how I updated the keystore.jks to run with letsencrypt!!

      • Register with any free dyndns provider (e.g. http://www.dnshome.de )
      • Enter the access data in your router

      The next step is a little bit tricky .. here is what I did

      • install apache2
      • enable port forwarding for port 80 in your router
      • https://tutorials-raspberrypi.de/raspberry-pi-ssl-zertifikat-kostenlos-mit-lets-encrypt-erstellen/

      The relevant certificate files are located here after running autocert:
      /etc/letsencrypt/live/YOURDOMAIN

      Then check this out (https://blog.codecentric.de/2013/01/selbstsignierte-zertifikate-aus-pem-dateien-in-java/)

      • openssl pkcs12 -export -out keystore.p12 -inkey privkey.pem -in cert.pem
      • keytool -importkeystore -destkeystore keystore.jks -srcstoretype PKCS12 -srckeystore keystore.p12
      • cp keystore.jks /home/pi/mycontroller/conf

      Edit mycontroller.properties:
      mcc.web.ssl.keystore.file=../conf/keystore.jks
      mcc.web.ssl.keystore.password=mycontroller
      mcc.web.ssl.keystore.type=JKS

      mycontroller must be replaced by the passwort you choose during certificate export with openssl

      You can now disable port forwarding for port 80 and enable port forwarding for port 8443 (be sure to choose a strong passwort)

      Result:
      0_1507657120186_470a10e6-5b49-4071-8679-ad784e0a14e8-image.png

      !!! Valid certificate in all major browsers (chrome in my example) !!!

      posted in Troubleshooting
      C
      cimba007
    • RE: Final 1.0.0 errors and crash report....

      I use mycontroller with HTTP and not HTTP and with esp8266 mqtt-gateway .. no problem so far with Final 1.0.0

      posted in Troubleshooting
      C
      cimba007
    • Question: Example script like "Operation send mail"

      Hello,

      I want to create a simple operation using scripting support and python.

      The python file should be executed and the parameter to the pythonfile should be the reason the operation triggered.

      It should be similar to the "send mail" operation but the parameters should be passed to a python script. Can anybodyd provide some basic information or an example as how to pass the parameters to a python script?

      In the end I would like to run an other command from python:

      yowsup-cli demos -l XXXX "Test"

      where "Test" should be replaced with the trigger reason.

      Thanks in advance!

      posted in Developers Zone
      C
      cimba007
    • RE: Graphical widgets loading forever

      @stefaanv https://github.com/mycontroller-org/mycontroller/issues/236#issuecomment-238017945

      Have a look if your adblocker is interfering. Press F12 in your browser and look at the "console"-output.

      An example of adblocker interfering:

      0_1470481819199_upload-c774db81-e0d5-48d7-abc7-98a05c8d3a94

      This can be solved by whitelisting the mycontroller.org site.

      posted in General Discussion
      C
      cimba007
    • RE: Graphical widgets loading forever

      [SOLVED]

      @jkandasa I don't get any graphical content at all, neither widgets nor under resources->sensors.

      Log stays empty as well, maybe increase the loggerlevel? But I don't know which one:

      2016-08-05 13:05:49,145 INFO [main] [org.mycontroller.standalone.StartApp:209] TJWS server started successfully, HTTPS Enabled?:true, HTTP(S) Port: [8443]
      2016-08-05 13:05:49,146 INFO [main] [org.mycontroller.standalone.StartApp:107] MyController.org server started in [20661] ms
      [Fri Aug 05 13:05:55 CEST 2016] IO error: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? in processing a request from /192.168.178.34:8443 / sun.security.ssl.SSLSocketImpl
      2016-08-05 13:07:46,362 INFO [Acme.Utils.ThreadPool(1)-PooledThread: Acme.Serve.Serve$ServeConnection@14b40fc] [org.mycontroller.standalone.gateway.mqtt.MqttGatewayImpl:70] MQTT Gateway[tcp://localhost:1883] connected successfully..
      2016-08-05 13:15:17,765 INFO [Acme.Utils.ThreadPool(6)-PooledThread: Acme.Serve.Serve$ServeConnection@293a6b] [org.mycontroller.standalone.mqttbroker.MoquetteMqttBroker:71] MQTT broker restart triggered...
      2016-08-05 13:19:24,743 INFO [Acme.Utils.ThreadPool(6)-PooledThread: Acme.Serve.Serve$ServeConnection@62c4af] [org.mycontroller.standalone.gateway.mqtt.MqttGatewayImpl:70] MQTT Gateway[tcp://localhost:1883] connected successfully..
      

      PS: This only affects the "Variables graphical view". Other graphical widgets are working fine. This issues affects dashboard and sensor-detail view stuff.

      Well I found the solution .. blocked by "ublock origin"

      posted in General Discussion
      C
      cimba007
    • RE: Mycontroller on Raspberry PI (RPI)

      Before you start installing Java maybe first check if you already have the "right" java version?

      pi@raspi ~ $ apt list --installed | grep java
      
      WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
      
      java-common/stable,now 0.52 all  [installiert]
      javascript-common/stable,now 11 all  [Installiert,automatisch]
      libjavascriptcoregtk-3.0-0/now 2.4.8-2+rpi1 armhf  [Installiert,aktualisierbar auf: 1:2.4.1-1rpi53rpi1g]
      oracle-java8-jdk/stable,now 8u65 armhf  [installiert]
      
      
      pi@raspi ~ $ cat /etc/os-release
      PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
      NAME="Raspbian GNU/Linux"
      VERSION_ID="8"
      VERSION="8 (jessie)"
      ID=raspbian
      ID_LIKE=debian
      HOME_URL="http://www.raspbian.org/"
      SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
      BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
      

      Got one of the more recent versions of raspbian and didn't have to install anything at all. Although I don't get any charts/images but might this be related to java?

      posted in Getting Started
      C
      cimba007