@jkandasa Turned out that EEPROM was not cleared properly with 0xFF
Best posts made by benya
-
RE: MySensor auto node ID
-
RE: Triggering rule through the HTTP request
Here is a sample REST API call that modifies MyController repository variable:
curl -X PUT -H "Content-Type: application/json" -d '{"key":"Var1","value":"222"}' "http://demo:demo@demo.mycontroller.org/mc/rest/variables"
-
RE: "Send email" questions
@jkandasa Yes, followed https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/ and got it working in short time.
-
RE: Synchronization between rules and timer handlers
@jkandasa We need some mechanism to prevent race condition.
-
RE: Controlling global variable and timer from Groovy
@benya I verified, Groovy could execute external tools. Tested with Demo system:
return "ls".execute().text.split("\n")
Result:
{ "mcResult": [ "Publicbroker-wstestmosquittoorg8080mqtt", "h2", "start.bat", "start.sh", "start_.sh", "stop.sh", "test_19Kz0-tcpwantsoftru1883", "test_48n0f-tcpwantsoftru1883", "test_FzOqu-tcpwantsoftru1883", "test_epPgp-tcpwantsoftru1883", "tmp" ] }
-
RE: Controlling global variable and timer from Groovy
@jkandasa Seems
mcApi.timer().update(myTimer);
causes timer to loose references to the operations and doesn't trigger operation when enabled again.I had better luck with the following code:
def filters = [:]; filters.put("name", "Timer1"); def myTimer = mcApi.timer().get(filters); def timerIds = [myTimer.getId()]; mcApi.timer().disable(timerIds) mcApi.timer().enable(timerIds)
-
RE: Triggering rule through the HTTP request
I figured how to set dummy sensor by script called through REST API.
I created "Set DummySensor" groovy script:
def uid = "DummySensor" def value = "1" def sensor = mcApi.uidTag().getByUid(uid).getResource() sensor.setValue(value) mcApi.sensor().sendPayload(sensor);
and call it through the REST API:
curl "http://admin:admin@localhost:9880/mc/rest/scripts/runNow?bindings=%7B+%7D&script=operations%2FSet+DummySensor.groovy&scriptBindings=%7B%7D"
I defined rule that gets triggered when dummy sensor value changes.
No 5 sec delays anymore. Cool!
Latest posts made by benya
-
RE: MySensor auto node ID
@mpp Guys in MySensors forum noticed I cleared EEPROM with zeros instead of 0xFF.
-
RE: Database issue?
@jkandasa I upgraded a while ago when you fixed another DB error.
New error appeared with no particular reason.
Should I restore DB from backup? -
Database issue?
I see the following errors in mycontroller.log and mycontroller process appears to be down:
2017-03-31 22:17:47,223 INFO [main] [org.mycontroller.standalone.db.DataBaseUtils:116] Checking migration... 2017-03-31 22:17:47,999 ERROR [main] [org.mycontroller.standalone.db.DataBaseUtils:119] Migration exception, org.flywaydb.core.internal.dbsupport.FlywaySqlException: Unable to obtain Jdbc connection from DataSource (jdbc:h2:file:../conf/mycontroller;MVCC=TRUE) for user 'mycontroller': General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SQL State : HY000 Error Code : 50000 Message : General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:396) at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnection(DriverDataSource.java:358) at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:51) at org.flywaydb.core.Flyway.execute(Flyway.java:1367) at org.flywaydb.core.Flyway.migrate(Flyway.java:930) at org.mycontroller.standalone.db.DataBaseUtils.runDatabaseMigration(DataBaseUtils.java:117) at org.mycontroller.standalone.StartApp.startServices(StartApp.java:251) at org.mycontroller.standalone.StartApp.startMycontroller(StartApp.java:108) at org.mycontroller.standalone.StartApp.main(StartApp.java:95) Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:168) at org.h2.message.DbException.convert(DbException.java:295) at org.h2.engine.Database.openDatabase(Database.java:304) at org.h2.engine.Database.<init>(Database.java:267) at org.h2.engine.Engine.openSession(Engine.java:64) at org.h2.engine.Engine.openSession(Engine.java:176) at org.h2.engine.Engine.createSessionAndValidate(Engine.java:154) at org.h2.engine.Engine.createSession(Engine.java:137) at org.h2.engine.Engine.createSession(Engine.java:27) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:349) at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:115) at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:99) at org.h2.Driver.connect(Driver.java:69) at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:393) ... 8 common frames omitted Caused by: java.lang.ArrayIndexOutOfBoundsException: 2048 at org.h2.store.Data.readInt(Data.java:160) at org.h2.index.PageDataNode.read(PageDataNode.java:105) at org.h2.index.PageDataNode.read(PageDataNode.java:84) at org.h2.store.PageStore.getPage(PageStore.java:799) at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:232) at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:85) at org.h2.table.RegularTable.<init>(RegularTable.java:83) at org.h2.store.PageStore.addMeta(PageStore.java:1696) at org.h2.store.PageStore.readMetaData(PageStore.java:1627) at org.h2.store.PageStore.recover(PageStore.java:1405) at org.h2.store.PageStore.openExisting(PageStore.java:367) at org.h2.store.PageStore.open(PageStore.java:288) at org.h2.engine.Database.getPageStore(Database.java:2482) at org.h2.engine.Database.open(Database.java:695) at org.h2.engine.Database.openDatabase(Database.java:273) ... 19 common frames omitted 2017-03-31 22:17:48,095 ERROR [main] [org.mycontroller.standalone.db.DataBaseUtils:132] Unable to close flyway connection org.flywaydb.core.internal.dbsupport.FlywaySqlException: Unable to obtain Jdbc connection from DataSource (jdbc:h2:file:../conf/mycontroller;MVCC=TRUE) for user 'mycontroller': General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SQL State : HY000 Error Code : 50000 Message : General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:396) at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnection(DriverDataSource.java:358) at org.mycontroller.standalone.db.DataBaseUtils.runDatabaseMigration(DataBaseUtils.java:127) at org.mycontroller.standalone.StartApp.startServices(StartApp.java:251) at org.mycontroller.standalone.StartApp.startMycontroller(StartApp.java:108) at org.mycontroller.standalone.StartApp.main(StartApp.java:95) Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:168) at org.h2.message.DbException.convert(DbException.java:295) at org.h2.engine.Database.openDatabase(Database.java:304) at org.h2.engine.Database.<init>(Database.java:267) at org.h2.engine.Engine.openSession(Engine.java:64) at org.h2.engine.Engine.openSession(Engine.java:176) at org.h2.engine.Engine.createSessionAndValidate(Engine.java:154) at org.h2.engine.Engine.createSession(Engine.java:137) at org.h2.engine.Engine.createSession(Engine.java:27) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:349) at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:115) at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:99) at org.h2.Driver.connect(Driver.java:69) at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:393) ... 5 common frames omitted Caused by: java.lang.ArrayIndexOutOfBoundsException: 2048 at org.h2.store.Data.readInt(Data.java:160) at org.h2.index.PageDataNode.read(PageDataNode.java:105) at org.h2.index.PageDataNode.read(PageDataNode.java:84) at org.h2.store.PageStore.getPage(PageStore.java:799) at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:232) at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:85) at org.h2.table.RegularTable.<init>(RegularTable.java:83) at org.h2.store.PageStore.addMeta(PageStore.java:1696) at org.h2.store.PageStore.readMetaData(PageStore.java:1627) at org.h2.store.PageStore.recover(PageStore.java:1405) at org.h2.store.PageStore.openExisting(PageStore.java:367) at org.h2.store.PageStore.open(PageStore.java:288) at org.h2.engine.Database.getPageStore(Database.java:2482) at org.h2.engine.Database.open(Database.java:695) at org.h2.engine.Database.openDatabase(Database.java:273) ... 16 common frames omitted 2017-03-31 22:17:48,568 ERROR [main] [org.mycontroller.standalone.db.DaoUtils:198] Unable to load Dao, org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: 2048" [50000-193] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:168) at org.h2.message.DbException.convert(DbException.java:295) at org.h2.engine.Database.openDatabase(Database.java:304) at org.h2.engine.Database.<init>(Database.java:267) at org.h2.engine.Engine.openSession(Engine.java:64) at org.h2.engine.Engine.openSession(Engine.java:176) at org.h2.engine.Engine.createSessionAndValidate(Engine.java:154) at org.h2.engine.Engine.createSession(Engine.java:137) at org.h2.engine.Engine.createSession(Engine.java:27) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:349) at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:115) at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:99) at org.h2.Driver.connect(Driver.java:69) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:208) at com.j256.ormlite.jdbc.JdbcConnectionSource.makeConnection(JdbcConnectionSource.java:266) at com.j256.ormlite.jdbc.JdbcPooledConnectionSource.getReadWriteConnection(JdbcPooledConnectionSource.java:140) at com.j256.ormlite.table.TableUtils.doCreateTable(TableUtils.java:397) at com.j256.ormlite.table.TableUtils.doCreateTable(TableUtils.java:383) at com.j256.ormlite.table.TableUtils.createTableIfNotExists(TableUtils.java:75) at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.<init>(BaseAbstractDaoImpl.java:65) at org.mycontroller.standalone.db.dao.ExternalServerDaoImpl.<init>(ExternalServerDaoImpl.java:38) at org.mycontroller.standalone.db.DaoUtils.loadAllDao(DaoUtils.java:157) at org.mycontroller.standalone.db.DataBaseUtils.runDatabaseMigration(DataBaseUtils.java:136) at org.mycontroller.standalone.StartApp.startServices(StartApp.java:251) at org.mycontroller.standalone.StartApp.startMycontroller(StartApp.java:108) at org.mycontroller.standalone.StartApp.main(StartApp.java:95) Caused by: java.lang.ArrayIndexOutOfBoundsException: 2048 at org.h2.store.Data.readInt(Data.java:160) at org.h2.index.PageDataNode.read(PageDataNode.java:105) at org.h2.index.PageDataNode.read(PageDataNode.java:84) at org.h2.store.PageStore.getPage(PageStore.java:799) at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:232) at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:85) at org.h2.table.RegularTable.<init>(RegularTable.java:83) at org.h2.store.PageStore.addMeta(PageStore.java:1696) at org.h2.store.PageStore.readMetaData(PageStore.java:1627) at org.h2.store.PageStore.recover(PageStore.java:1405) at org.h2.store.PageStore.openExisting(PageStore.java:367) at org.h2.store.PageStore.open(PageStore.java:288) at org.h2.engine.Database.getPageStore(Database.java:2482) at org.h2.engine.Database.open(Database.java:695) at org.h2.engine.Database.openDatabase(Database.java:273) ... 24 common frames omitted 2017-03-31 22:17:49,136 ERROR [main] [org.mycontroller.standalone.StartApp:97] Unable to start application, refer error log, java.lang.NullPointerException: null at org.mycontroller.standalone.settings.SettingsUtils.getValue(SettingsUtils.java:57) at org.mycontroller.standalone.settings.SettingsUtils.getValue(SettingsUtils.java:62) at org.mycontroller.standalone.settings.LocationSettings.getValue(LocationSettings.java:72) at org.mycontroller.standalone.settings.LocationSettings.get(LocationSettings.java:57) at org.mycontroller.standalone.AppProperties.loadPropertiesFromDb(AppProperties.java:520) at org.mycontroller.standalone.db.DataBaseUtils.runDatabaseMigration(DataBaseUtils.java:141) at org.mycontroller.standalone.StartApp.startServices(StartApp.java:251) at org.mycontroller.standalone.StartApp.startMycontroller(StartApp.java:108) at org.mycontroller.standalone.StartApp.main(StartApp.java:95) Exception in thread "MyController.org Shutdown-Hook" java.lang.NullPointerException at Acme.Serve.Serve.stopBackground(Serve.java:684) at org.jboss.resteasy.plugins.server.tjws.TJWSServletServer.stop(TJWSServletServer.java:184) at org.mycontroller.standalone.StartApp.stopHTTPWebServer(StartApp.java:222) at org.mycontroller.standalone.StartApp.stopServices(StartApp.java:303) at org.mycontroller.standalone.AppShutdownHook$1.run(AppShutdownHook.java:34)
-
RE: Triggering rule through the HTTP request
I figured how to set dummy sensor by script called through REST API.
I created "Set DummySensor" groovy script:
def uid = "DummySensor" def value = "1" def sensor = mcApi.uidTag().getByUid(uid).getResource() sensor.setValue(value) mcApi.sensor().sendPayload(sensor);
and call it through the REST API:
curl "http://admin:admin@localhost:9880/mc/rest/scripts/runNow?bindings=%7B+%7D&script=operations%2FSet+DummySensor.groovy&scriptBindings=%7B%7D"
I defined rule that gets triggered when dummy sensor value changes.
No 5 sec delays anymore. Cool! -
RE: Triggering rule through the HTTP request
Looks like dummy sensor variable triggers rule much faster than repository variable.
How could I change sensor variable (referring by UID tag) through REST API?
Could you post sample HTTP payload? -
RE: "Send email" questions
@jkandasa Yes, followed https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/ and got it working in short time.
-
RE: Rule and operation order
Any chance to overcome this limitation?
At least keep operations in the order they were added to the rule. -
RE: "Send email" questions
I guess local postfix server would address both issues (performance and email delivery reliability).
-
Rule and operation order
I defined rule that triggers execution of a few operations.
I'd like operations to be executed in a specific order.
When I add operations, they appear in the list in the alphabetical order.
Is there a way to reorder operations or add new item to the end of list?