• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. ragflyer
    3. Posts
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 24
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Connect Sonoff running Tasmota

      Found a workaround using Node-Red, for newbies like me this might be helpful:

      Flash Tasmota to your Sonoff,
      set MQTT topic to e.g. sonoff-1234,
      full topic to e.g. /smarthome/%prefix%/%topic%/

      Install Node-Red, add node-red-dashboard.
      Drag a MQTT input, set topic to /smarthome/stat/sonoff-1234/POWER
      Add a switch, uncheck "If msg arrives on input, pass through to output:", let it show state of the input, set on payload to String "ON", off payload to "OFF"
      Add a MQTT output, set topic to /smarthome/cmnd/sonoff-1234/power

      Now you should have a working switch on the Node-Red dashboard, it should always show the state of the sonoff.

      To show the state of the switch in Mycontroller, add a Function and connect it to MQTT input:
      if (msg.payload == "ON") {
      msg.payload = 1;
      } else if(msg.payload == "OFF") {
      msg.payload = 0;
      }
      return msg;

      There is a replace function for message payloads, you could use that instead.
      Connect a MQTT output to the function, set topic to
      mygateway-out/<id>/<child-id>/1/0/2

      This will post the converted on/off message to mysensors format to be read by the mycontroller mqtt gateway.

      posted in General Discussion
      R
      ragflyer
    • RE: Open and export from H2 Database

      Thanks, was looking for that. Also Cimba007 explained the steps at https://github.com/mycontroller-org/mycontroller/issues/392

      Still it won't work here likely because I can't find the correct version of h2.
      I'm still running 0.0.3.Final-SNAPSHOT with db 1.03.03 - 2016 Sep 20

      I tried to upgrade, but backup fails (400: Bad Request Database backup failed!).
      I tried to find mentioned db version, the newest from 1.3 branch (1.3.176) did seem to open the db but showed no user or metrics tables.

      Can I convert it somehow to the new version and also fix the index issue Cimba007 explained (I'm suffering very slow UI even running the server on a decent workstation)?

      logfile:

      2018-05-11 10:22:43,754 ERROR [Acme.Utils.ThreadPool(7)-PooledThread: Acme.Serve.Serve$ServeConnection@41ba151f] [org.mycontroller.standalone.db.DataBaseUtils:208] Exception, backup failed!
      org.h2.jdbc.JdbcSQLException: File corrupted while reading record: "[64043] stream data key:4220 pos:11 remaining:0". Possible solution: use the recovery tool; SQL statement:
      SCRIPT TO ? COMPRESSION ZIP [90030-176]
      	at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
      	at org.h2.message.DbException.get(DbException.java:178)
      	at org.h2.message.DbException.get(DbException.java:154)
      	at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:242)
      	at org.h2.index.PageDataNode.getNextPage(PageDataNode.java:233)
      	at org.h2.index.PageDataLeaf.getNextPage(PageDataLeaf.java:400)
      	at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:95)
      	at org.h2.index.PageDataCursor.next(PageDataCursor.java:53)
      	at org.h2.command.dml.ScriptCommand.generateInsertValues(ScriptCommand.java:403)
      	at org.h2.command.dml.ScriptCommand.query(ScriptCommand.java:301)
      	at org.h2.command.CommandContainer.query(CommandContainer.java:91)
      	at org.h2.command.Command.executeQuery(Command.java:197)
      	at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:193)
      	at org.mycontroller.standalone.db.DataBaseUtils.backupDatabase(DataBaseUtils.java:204)
      	at org.mycontroller.standalone.backup.Backup.backup(Backup.java:60)
      	at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:182)
      	at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:193)
      	at org.mycontroller.standalone.api.jaxrs.BackupHandler.backupNow(BackupHandler.java:107)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      	at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
      	at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
      	at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
      	at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
      	at java.lang.Thread.run(Thread.java:748)
      2018-05-11 10:22:43,757 ERROR [Acme.Utils.ThreadPool(7)-PooledThread: Acme.Serve.Serve$ServeConnection@41ba151f] [org.mycontroller.standalone.api.jaxrs.BackupHandler:109] Error,
      org.mycontroller.standalone.exceptions.McException: Database backup failed!
      	at org.mycontroller.standalone.backup.Backup.backup(Backup.java:75)
      	at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:182)
      	at org.mycontroller.standalone.api.BackupApi.backupNow(BackupApi.java:193)
      	at org.mycontroller.standalone.api.jaxrs.BackupHandler.backupNow(BackupHandler.java:107)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      	at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
      	at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
      	at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
      	at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
      	at java.lang.Thread.run(Thread.java:748)
      
      posted in Developers Zone
      R
      ragflyer
    • Open and export from H2 Database

      I would like to try to edit my database to get some older data for other purposes and then reduce file size.
      Unfortunately I could not find any data when opening the file on another machine.
      I tried H2 commandline tool and SQL Workbench on Windows after copying the big mycontroller database to this machine.
      Could you give a hint on a setup you might be using for debugging and on the db structure, e.g. where to find the sensor data?

      posted in Developers Zone
      R
      ragflyer
    • Connect Sonoff running Tasmota

      Tasmota is a popular open firmware for the Sonoff switches. It features a MQTT interface and I thought it would be good to connect it to Mycontroller.
      I couldn't configure Tasmota to publish in a Mysensors compatible format.
      Topic is configurable, but the last part and paypload are fixed and would have to be changed in the sourcecode.

      Messages of Tasmota look like this:

      00:00:08 MQT: mygateway-in/25/1/1/0/2/RESULT = {"POWER2":"OFF"}
      00:00:08 MQT: mygateway-in/25/1/1/0/2/POWER2 = OFF
      00:00:09 MQT: mygateway-in/25/1/1/0/2/RESULT = {"POWER1":"OFF"}
      00:00:09 MQT: mygateway-in/25/1/1/0/2/POWER1 = OFF
      12:00:22 MQT: mygateway-in/25/1/1/0/2/STATE = {"Time":"2018.05.09 12:00:22","Uptime":"0 00:00:15","Vcc":3.499,"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"2.4GHz","RSSI":78,"APMac":"46:..."}}
      12:02:00 MQT: mygateway-in/25/1/1/0/2/UPTIME = {"Time":"2018.05.09 12:02:00","Uptime":"0 00:01:53"}
      12:05:22 MQT: mygateway-in/25/1/1/0/2/STATE = {"Time":"2018.05.09 12:05:22","Uptime":"0 00:05:15","Vcc":3.499,"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"2.4GHz","RSSI":82,"APMac":"46:..."}}

      Any idea what would be the quickest way to make these devices compatible?

      Communication of Tasmota: https://github.com/arendst/Sonoff-MQTT-OTA-Arduino/wiki/MQTT-for-Newbies

      posted in General Discussion
      R
      ragflyer
    • RE: Mysql connection not working for me

      @njbuch Have you had any success?

      posted in Troubleshooting
      R
      ragflyer
    • RE: Graphs hang "Loading..." after few minutes

      @jkandasa It is temperature, particle, CO2, rainfall etc. I try to collect data long term for later analysis, space is available, so maybe I should use another DB backend?

      posted in Troubleshooting
      R
      ragflyer
    • Graphs hang "Loading..." after few minutes

      I collected some data over past months, the db is about 500MB now and all is fine when I start up mycontroller. But after just a few minutes graphs will not load but instead show "Loading..." forever.
      When I stop and start mycontroller, it works again for some time.
      CPU and memory load seems fine in 'top'.

      posted in Troubleshooting
      R
      ragflyer
    • Adding data from the past

      I have a device that caches data and I want to send over packets of maybe 30 minutes data over to MyController.
      It is remote, so it would be nice to do this via MQTT.
      Question is, how can I tell MyController the timestamp of each datapoint to write it to the database correctly, is that even possible?

      posted in Developers Zone
      R
      ragflyer
    • RE: PID-Controller implementation

      Do you have a sample script where there is an input from one sensor and an output to an actuator for me to study?

      A PID-Controller is actually quite universal. All adjustment to the process you want to control is set through the 3 constants kp, ki, kd.
      I imagine a new condition type "PID-Controller" in the Rules tab with settings of source sensor, kp, ki, kd, and destination actuator or operation.
      Is it possible to give the result value to an operation as argument, so it can send it to a sensor variable as payload?
      There are lots of ready implementations for the simple math, e.g. https://github.com/rudin-io/pid/blob/master/controller/src/main/java/li/rudin/pid/controller/PIDController.java

      posted in Developers Zone
      R
      ragflyer
    • PID-Controller implementation

      Hi,
      I built actuators for the radiators in my room and connected it to mycontroller via MQTT successfully.
      Now instead of creating a set of rules with some kind of hysteresis I was wondering if it would make sense to implement something like a PID-Controller to keep the desired room temperature.
      How would you go about it?

      posted in Developers Zone
      R
      ragflyer
    • RE: keystore and certificate on client

      OK that worked. Few more things to note for newcomers:

      • password and name of file is stored in mycontroller config file
      • Common Name (keytool asks for First and Lastname) is where you put the server/domain name or IP adress as the browser will check this against the certificate.
      • Now export, copy to client, after import on MacOS find the cert in the keyring (search IP), right click, information, trust, set SSL to always trust. Now the browser should accept it without asking you.
      posted in General Discussion
      R
      ragflyer
    • keystore and certificate on client

      I would like to get rid of the page warning of untrusted server at the login and tried to feed mycontroller a new keystore.jks:

      keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass xxxxxx -validity 360 -keysize 2048
      keytool -export -alias selfsigned -keystore keystore.jks -file root.cer
      

      Now the server won't start and I get a log message:
      java.io.IOException: Keystore was tampered with, or password was incorrect

      When I try to export the original keystore.jks I get an error on the client. Could somebody give me a hint on how to achieve what I intended?

      posted in General Discussion
      R
      ragflyer
    • RE: Time zone issue

      Issue was related to Google Chrome only.
      Resetting browsing data got it back into the correct time zone.

      posted in Troubleshooting
      R
      ragflyer
    • RE: Time zone issue

      @jkandasa Server is an old Win-XP laptop in zone +0100

      posted in Troubleshooting
      R
      ragflyer
    • Time zone issue

      I have two machines accessing the Mycontroller default Dashboard, one MacOS, one Windows-7, both on Chrome, both in same time-zone.
      Windows uses +0200
      MacOS uses +0100

      I tried the cache reset described in this forum, did not help
      Any idea what could be wrong here?

      posted in Troubleshooting
      R
      ragflyer
    • RE: MQTT sample setup on ESP8266

      Nice it works, thanks for pointing this out!

      Few more things that might be helpful for newcomers:

      • If you misconfigured so far that no connection to MyController is possible, the above "Erase configuration" obviously won't work. Load the example sketch for eeprom_clear and upload it, then upload your MyControllerDevice sketch again, connect to the ESP SSID and rerun configuration at http://192.168.4.1

      • Feed ID will not take more than 6 characters

      • You cannot set up a second gateway at say :1884 if you configured the broker to run at :1883. But it seems to be ok to define several Gateways with different topics on the same port (so you don't have to migrate existing nodes to another topic now).

      posted in MyControllerDevice (ESP8266)
      R
      ragflyer
    • RE: MQTT sample setup on ESP8266

      @jkandasa OK, how do you change the node config once it is saved? Uploading the sketch does not set it back to AP mode 😞

      posted in MyControllerDevice (ESP8266)
      R
      ragflyer
    • RE: MQTT sample setup on ESP8266

      @jkandasa Awesome. I've been trying your sample, but where do you define ssid and password?
      For now I've set it up through the web interface of the node, but then I cannot find where the serial output is coming from, especially where the topic "in_3/ESP_0F..." is defined? It seems like none of the files contains this...
      Finally I need to set up a gateway type MyController correct? Probably I need to use a different port if the MQTT gateway should be running alongside?

      posted in MyControllerDevice (ESP8266)
      R
      ragflyer
    • MQTT sample setup on ESP8266

      Being new to this stuff it is sometimes hard to find all the necessary info, so I would like to provide you with a sample and hope it eases your way to experimenting with this cool project.

      We will connect a sample sketch from the PubSubClient library for ESP8266 to MyController through MQTT.

      Tested on SNAPSHOT, find it here

      1. Activate the MQTT broker on your MyController
        Settings -> MQTT broker -> Status Enabled
        I prefer to allow anonymous in the beginning to eliminate one source of errors.

      0_1479144062154_Bildschirmfoto 2016-11-14 um 18.19.55.png

      1. Add MQTT gateway :
        Resources -> Gateway -> Add gateway.
        You can use mostly default values, important is Network Type, Type and the correct direction of your topics: mygateway-out is where your sensors should post data, mygateway-in is what your client should subscribe to get changes from MyController (e.g. a relay).

      0_1479161074792_Bildschirmfoto 2016-11-14 um 18.35.26.png

      1. Install PubSubClient library in Arduino IDE
        Sketch Menu -> Include Libraries -> Manage Libraries

      2. Open ESP8266 Example
        File -> Examples -> PubSubClient -> mqtt_esp8266

      3. Save it in your own project path

      4. Edit SSID, Password in your sketch and set mqtt_server constant to the IP of your MyController MQTT broker

      5. Now the fun part: MyController can accept MQTT messages in MySensors format. The API is described at Serial API 2.0
        For your sketch this means you need to publish into topics following this format, e.g.:

        #define temperature_topic "mygateway-out/7/0/1/0/0"

      Here MyConroller subscribes to mygateway-out and will interpret:
      /5: Node ID 5
      /0: Child sensor ID 0
      /1: Message type 'set'
      /0: ack-parameter: Normal message
      /0: Sub-type: V_TEMP

      So add the #define in your sketch e.g. after the #includes and go to line 100 where client.publish is called:

      client.publish("outTopic","hello world");

      change this to use your topic from above and post a temperature of whatever degrees:

      client.publish(temperature_topic,"10.50");

      Compile and run the sketch

      1. Monitor incoming messages
        Status -> Resources logs
        Now you should see incoming temperature messages with 10.50 degrees.

      0_1479161892596_Bildschirmfoto 2016-11-14 um 23.15.23.png

      The sensor resource should be created automatically.

      Now if you want to control a relay for example, you create that sensor (actually actuator) and in your sketch do a client.subscribe("mygateway-in/<NodeID>/<ChildID>/1/0/<Sub-type>");
      I sometimes got the mygateway-in/out switched accidentally, you will see nothing on the logs, so double-check!

      Thanks to Jeeva for this great piece of software and untiring support!

      EDIT:
      Two quotes from jkandasa that might be helpful:

      Mycontroller format is described here: https://github.com/mycontroller-org/mycontroller/blob/development/modules/core/src/main/java/org/mycontroller/standalone/provider/mc/McpRawMessage.java#L81

      When you set this line <logger level="DEBUG" name="org.mycontroller.standalone.gateway.mqtt" /> on conf/logback.xml you can see MQTT debug logs.

      posted in MyControllerDevice (ESP8266)
      R
      ragflyer
    • Same or different child IDs for multi-sensor nodes

      How do you handle it with nodes publishing several sensors, do you let them publish under one single child ID to get all values on one page in MyController?
      I found out this possibility today and like the reduction in nodes and better view of several sensors in one page, but cannot tell if there are any downsides to this?

      posted in General Discussion
      R
      ragflyer