360manu / pimatic-mythermostat

Thermostat plugin for the Pimatic
7 stars 3 forks source link

Adding a device with defaults raises fatal error #2

Open mwittig opened 8 years ago

mwittig commented 8 years ago

Using pimatic 0.9, adding a device with defaults raises the following exception:

Knex:warning - calling knex without a tableName is deprecated. Use knex.queryBuilder() instead.
11:57:34.125 [pimatic-mobile-frontend] rendering html finished
11:57:34.132 [pimatic] Listening for HTTP-request on port 91...
Fatal Error: insert into  ("deviceAttributeId", "time", "value") values (58, '2016-05-19 11:57:28.038', '{"end":1440,"temp":17}') - SQLITE_ERROR: near "(": syntax error
    at Error (native)

Process finished with exit code 2
adargu commented 6 years ago

I think i have the same problem. I used the config from the README.md. Wasn't able to run this plugin at all.

16:30:49.093 [pimatic, ppm] 2.15.12
16:30:50.802 [pimatic] Installing: "pimatic-mythermostat@0.0.3" from npm-registry.
16:31:13.211 [pimatic, ppm] WARN peerDependencies The pimatic plugin pimatic-mythermostat is maybe not compatible with your pimatic version.
Knex:warning - calling knex without a tableName is deprecated. Use knex.queryBuilder() instead.
Fatal Error: insert into  ("deviceAttributeId", "time", "value") values (54, '2017-10-14 16:35:02.541', {"end":420,"temp":18.5}, {"end":540,"temp":19.5}, {"end":1320,"temp":20.5}, {"end":1440,"temp":18.5}) - SQLITE_ERROR: near "(": syntax error
    at Error (native)

22:34:55.169 [pimatic] An uncaught exception occurred: Error: write EPIPE                                                                                                                                                                     
22:34:55.169 [pimatic]>    at exports._errnoException (util.js:911:11)                                                                                                                                                                        
22:34:55.169 [pimatic]>    at WriteWrap.afterWrite (net.js:785:14)                                                                                                                                                                            
22:34:55.169 [pimatic]>From connect                                                                                                                                                                                                           
22:34:55.169 [pimatic]>    at Socket.connect (/home/pi/pimatic/node_modules/pimatic/startup.coffee:55:29)                                                                                                                
22:34:55.169 [pimatic]>    at Object.exports.connect.exports.createConnection (net.js:68:26)                                                                                                                                                  
22:34:55.169 [pimatic]>    at Function.MpdClient.connect (/home/pi/pimatic/node_modules/pimatic-mpd/node_modules/mpd/index.js:32:23)                                                                                     
22:34:55.169 [pimatic]>    at MpdPlayer._connect (/home/pi/pimatic/node_modules/pimatic-mpd/mpd.coffee:41:22)                                                                                                            
22:34:55.169 [pimatic]>    at new MpdPlayer (/home/pi/pimatic/node_modules/pimatic-mpd/mpd.coffee:36:8)                                                                                                                  
22:34:55.169 [pimatic]>    at Object.framework.deviceManager.registerDeviceClass.createCallback (/home/pi/pimatic/node_modules/pimatic-mpd/mpd.coffee:26:37)                                                             
22:34:55.169 [pimatic]>    at DeviceManager._loadDevice (/home/pi/pimatic/node_modules/pimatic/lib/devices.coffee:1475:26)                                                                                               
22:34:55.169 [pimatic]>    at /home/pi/pimatic/node_modules/pimatic/lib/devices.coffee:1504:16                                                                                                                           
22:34:55.169 [pimatic]>    at tryCatcher (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/util.js:16:23)                                                                                          
22:34:55.169 [pimatic]>    at Promise._settlePromiseFromHandler (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:512:31)                                                               
22:34:55.169 [pimatic]>    at Promise._settlePromise (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:569:18)                                                                          
22:34:55.169 [pimatic]>    at Promise._settlePromise0 (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:614:10)                                                                         
22:34:55.169 [pimatic]>    at Promise._settlePromises (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:693:18)                                                                         
22:34:55.169 [pimatic]>    at Async._drainQueue (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/async.js:133:16)                                                                                 
22:34:55.169 [pimatic]>    at Async._drainQueues (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/async.js:143:10)                                                                                
22:34:55.169 [pimatic]>    at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/pimatic/node_modules/pimatic/node_modules/bluebird/js/release/async.js:17:14)                                                      
22:34:55.169 [pimatic]>    at processImmediate [as _immediateCallback] (timers.js:383:17)                                                                                                                                                     
22:34:55.169 [pimatic]> This is most probably a bug in pimatic or in a module, please report it!                                                                                                                                              
22:34:55.243 [pimatic] shutting pimatic down...                                                                                                                                                                                               
/home/pi/pimatic/node_modules/pimatic/startup.coffee:98                                                                                                                                                                  
          return framework.destroy().then(function() {                                                                                                                                                                                        
                 ^                                                                                                                                                                                                                            

ReferenceError: framework is not defined                                                                                                                                                                                                      
    at process.uncaughtException (/home/pi/pimatic/node_modules/pimatic/startup.coffee:85:9)                                                                                                                             
    at emitOne (events.js:77:13)                                                                                                                                                                                                              
    at process.emit (events.js:169:7)                                                                                                                                                                                                         
    at process._fatalException (node.js:224:26)                                                                                                                                                                                               
[1]+  Fertig                  cp cached_remotes_lirc.json /tmp/ && ./check-cached-lirc.py  
p4co86 commented 6 years ago

same here. very bad, i would use it in combination with the new pimatic echo plugin. Please Fix it! Keep up the nice work!

360manu commented 6 years ago

Hello

Can you send me the :

Thanks

mwittig commented 6 years ago

Guys did you set setup the definition mentioned in section "The Trick!"? - https://github.com/360manu/pimatic-mythermostat#the-trick

EDIT: I have just retried and when I extend the "deviceAttributeLogging" configuration as described in section "The Trick!" BEFORE I setup the device, it works right away! The README should be reworded so, that the first step is to extend "deviceAttributeLogging".

image

adargu commented 6 years ago

I did "The Trick". On my last post I put in the exact and complete config from the README.md from the section "Full config" at once.

Now I only put in this parts:

  "plugins": [
    {
      "plugin": "mythermostat"
    },
.
.
.
 "deviceAttributeLogging": [
        { 
          "attributeName": "currentProgram",
          "deviceId": "*",
          "expire": "0d",
          "type": "*"
        },
.
.
.

and tried to config the Thermostat with the GUI. After i pressed "Save" it crashed with the following output:

14:18:59.764 [pimatic] New device "heatingtest"...
Knex:warning - calling knex without a tableName is deprecated. Use knex.queryBuilder() instead.
Fatal Error: insert into  ("deviceAttributeId", "time", "value") values (69, '2017-11-20 14:19:00.479', {"end":1440,"temp":0}) - SQLITE_ERROR: near "(": syntax error
    at Error (native)

This is my database and plugins section, maybe there is a collision:

   "database": {
      "deviceAttributeLogging": [
        {
          "attributeName": "currentProgram",
          "deviceId": "*",
          "expire": "0d",
          "type": "*"
        },
        {
          "attributeName": "*",
          "deviceId": "*",
          "expire": "7d",
          "interval": "0",
          "type": "*"
        },
        {
          "attributeName": "*",
          "deviceId": "*",
          "expire": "7d",
          "interval": "5min",
          "type": "continuous"
        },
        {
          "attributeName": "temperature",
          "deviceId": "*",
          "expire": "1y",
          "type": "number"
        },
        {
          "attributeName": "humidity",
          "deviceId": "*",
          "expire": "1y",
          "type": "number"
        }
      ],
  "plugins": [
    {
      "plugin": "mythermostat"
    },
    {
      "plugin": "cron"
    },
    {
      "active": true,
      "debug": true,
      "plugin": "mobile-frontend",
      "theme": "graphite/royal"
    },
    {
      "interfaceAddress": "192.168.1.3",
      "plugin": "amazing-dash-button"
    },
    {
      "active": true,
      "plugin": "ds18b20"
    },
    {
      "active": true,
      "debug": true,
      "driver": "serialport",
      "driverOptions": {
        "baudrate": 115200,
        "serialDevice": "<secret>"
      },
      "plugin": "homeduino",
      "receiverPin": 0,
      "transmitterPin": 4
    },
    {
      "active": true,
      "plugin": "lirc"
    },
    {
      "active": true,
      "plugin": "mpd"
    },
    {
      "active": false,
      "adminId": "<secret>",
      "debug": true,
      "defaultId": "<secret>",
      "keepaliveInterval": 5,
      "nickId": "<secret>",
      "password": "<secret>",
      "plugin": "xmpp",
      "user": "<secret>"
    },
    {
      "active": true,
      "plugin": "shell-execute"
    },
    {
      "active": false,
      "debug": true,
      "plugin": "gpio"
    },
    {
      "plugin": "led-light",
      "active": true
    },
    {
      "plugin": "chronotherm",
      "active": true
    }
  ],