Issue was related to Google Chrome only.
Resetting browsing data got it back into the correct time zone.
Best posts made by ragflyer
-
RE: Time zone issue
-
RE: Is their an option to enable ack for messages the gateway originates?
@jkandasa I think the main issue here is a visual switch going from ON to OFF without the confirmation if the command really has been received.
This is actually a showstopper for many use cases with involving relays.Could we implement a mode where the switch goes into 'undefined' (like when it was created) and sends a 'request state' to the node x milliseconds after the 'set 0' command. Then it sets the switch according to the received state
- either back to ON (if the user generated 'set 0' was unsuccessful),
- still 'undefined' if the 'request state' has not been successful,
- or OFF if the 'set 0' and 'request state' have been successful.
-
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).
-
-
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 -
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.
-
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
- 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.
- 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).
-
Install PubSubClient library in Arduino IDE
Sketch Menu -> Include Libraries -> Manage Libraries -
Open ESP8266 Example
File -> Examples -> PubSubClient -> mqtt_esp8266 -
Save it in your own project path
-
Edit SSID, Password in your sketch and set mqtt_server constant to the IP of your MyController MQTT broker
-
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_TEMPSo 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
- Monitor incoming messages
Status -> Resources logs
Now you should see incoming temperature messages with 10.50 degrees.
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.
- Activate the MQTT broker on your MyController
-
RE: Is their an option to enable ack for messages the gateway originates?
@rayven AFAIK Mysensors does not resend automatically.
I understood we cannot rely on ACK as the gateway gives you the ACK without ensuring the End Node has ACKed first!
That means for switching applications it is currently useless and we simply cannot rely on the protocol but have to implement a check in the controller before presenting a supposed state to the user.https://forum.mysensors.org/topic/2189/serial-api-noack-when-sending-with-ack-failed
Latest posts made by ragflyer
-
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/powerNow 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/2This will post the converted on/off message to mysensors format to be read by the mycontroller mqtt gateway.
-
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 20I 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)
-
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? -
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
-
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?
-
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'. -
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? -
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 -
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?