@arteck said in Datenbank Abfrage mit Blockly:
mach ein issue auf GIT auf
da haste mich mal voll auf dem falschen Fuß erwischt. Ich schau morgen mal nach. Danke schon mal.
@arteck said in Datenbank Abfrage mit Blockly:
mach ein issue auf GIT auf
da haste mich mal voll auf dem falschen Fuß erwischt. Ich schau morgen mal nach. Danke schon mal.
Hallo zusammen,
ich war kurzfristig am Verzweifeln, warum bei einem Send to SQL bei mir Fehler auftauchten!!
Problem war, dass das Blockly den falschen Code für JS erzeugt. So wie es aussieht (zumindest für die Abfrage für eine SQL Datenbank)
Blockly Skript:
var result;
on({id: [].concat(['proxmox.0.node_ProxMoxServ1.cpu']), change: "ne"}, async function (obj) {
var value = obj.state.val;
var oldValue = obj.oldState.val;
sendTo("sql.1", "query", {
"result": ['UPDATE iobroker.aktuellewerte SET `val`=\' ',getState("proxmox.0.node_ProxMoxServ1.cpu").val,'WHERE `name`=\'ProxmoxCPU\''].join('')
}, async function (result) {
console.log(result);
});
});
Mein geändertes funktionierendes Skript
var result;
on({id: [].concat(['proxmox.0.node_ProxMoxServ1.cpu']), change: "ne"}, async function (obj) {
var value = obj.state.val;
var oldValue = obj.oldState.val;
var ProxCPUload = getState("proxmox.0.node_ProxMoxServ1.cpu").val;
sendTo('sql.1', 'query', 'UPDATE iobroker.aktuellewerte SET val='+ ProxCPUload +' WHERE name="ProxMoxCPU"'
, function (result) {
console.log(ProxCPUload);
console.log("Update erfolgreich")
});
});
Jetzt kommt die Frage:
Gibt es die Möglichkeit einen eigenen Block für eine SQL Query zu machen?
Das würde eventuell vielen helfen.
Gruß Metalesel
Hallo Zusammen,
lag wohl doch daran, dass ich noch keine Geräte an der CCU hatte.... nachdem der Raspberry mit RaspberryMatic gefüttert war und Geräte hatte, wurde auch die hm-rpc grün...
Mit der VM muss ich noch schauen .. habe ein Funkmodul .. problem ist nur, dass ich dieses erst downgraden muss ...
Danke für eure Hilfe.
@glasfaser also.... ich bestell mal einen Homematic IP mit Lan anschluss (In der hoffnung das der sich dann als Lan -Router verbinden lässt) und dann binde ich mal was ein.
Dann melde ich mich wieder..
Kann es sein.. weil ich noch keine Homematic Geräte habe, dass er deswegen die Fehlermeldung bringt. ??
@glasfaser
gemacht... User in der RM als Admin angelegt.
hab ich gemacht.. und mal die Adapter (rega und den rpc neu gestartet.. log anbei ...
2021-10-02 20:27:53.435 - info: host.raspberrypi stopInstance system.adapter.hm-rega.0 (force=false, process=true)
2021-10-02 20:27:53.958 - info: hm-rega.0 (11559) Got terminate signal TERMINATE_YOURSELF
2021-10-02 20:27:53.985 - info: host.raspberrypi stopInstance system.adapter.hm-rega.0 send kill signal
2021-10-02 20:27:54.095 - info: hm-rega.0 (11559) terminating
2021-10-02 20:27:54.099 - info: hm-rega.0 (11559) Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason
2021-10-02 20:27:55.198 - info: host.raspberrypi instance system.adapter.hm-rega.0 terminated with code 11 (ADAPTER_REQUESTED_TERMINATION)
2021-10-02 20:27:55.932 - info: host.raspberrypi stopInstance system.adapter.hm-rpc.1 (force=false, process=true)
2021-10-02 20:27:55.942 - info: host.raspberrypi stopInstance system.adapter.hm-rpc.1 send kill signal
2021-10-02 20:27:55.942 - info: hm-rpc.1 (11700) Got terminate signal TERMINATE_YOURSELF
2021-10-02 20:27:55.946 - info: hm-rpc.1 (11700) xmlrpc -> 192.168.1.179:42010/ init ["http://192.168.1.230:42010",""]
2021-10-02 20:27:55.986 - error: hm-rpc.1 (11700) Cannot call init: [http://192.168.1.230:42010, ""] Unknown XML-RPC tag 'TITLE'
2021-10-02 20:27:55.989 - info: hm-rpc.1 (11700) terminating
2021-10-02 20:27:55.992 - info: hm-rpc.1 (11700) Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason
2021-10-02 20:27:57.272 - info: host.raspberrypi instance system.adapter.hm-rpc.1 terminated with code 11 (ADAPTER_REQUESTED_TERMINATION)
2021-10-02 20:27:57.873 - info: host.raspberrypi instance system.adapter.hm-rega.0 started with pid 11728
2021-10-02 20:28:01.639 - info: host.raspberrypi instance system.adapter.hm-rpc.1 started with pid 11741
2021-10-02 20:28:03.488 - info: hm-rega.0 (11728) starting. Version 3.0.31 in /opt/iobroker/node_modules/iobroker.hm-rega, node: v12.22.1, js-controller: 3.2.16
2021-10-02 20:28:04.267 - info: hm-rega.0 (11728) subscribe .BidCoS-RF.50.PRESS_SHORT
2021-10-02 20:28:04.481 - info: hm-rega.0 (11728) ReGaHSS 192.168.1.179 up
2021-10-02 20:28:06.613 - info: hm-rega.0 (11728) time difference local-ccu 1s
2021-10-02 20:28:11.004 - info: hm-rega.0 (11728) request state values
2021-10-02 20:28:11.041 - info: hm-rega.0 (11728) Updated all datapoints
2021-10-02 20:28:11.549 - info: hm-rega.0 (11728) got 5 variables
2021-10-02 20:28:11.611 - info: hm-rpc.1 (11741) starting. Version 1.14.45 in /opt/iobroker/node_modules/iobroker.hm-rpc, node: v12.22.1, js-controller: 3.2.16
2021-10-02 20:28:11.619 - error: hm-rega.0 (11728) Cannot parse answer for variables: {"40":{"Name":"Alarmmeldungen","TypeName":"VARDP","DPInfo":"Anzahl%20Alarmmeldungen","Value":,"ValueMin":0,"ValueMax":65000,"ValueUnit":"","ValueType":16,"ValueSubType":0,"ValueList":""},
"41":{"Name":"Servicemeldungen","TypeName":"VARDP","DPInfo":"Anzahl%20Servicemeldungen","Value":0,"ValueMin":0,"ValueMax":65000,"ValueUnit":"","ValueType":16,"ValueSubType":0,"ValueList":""},
"40":{"Name":"%24%7BsysVarAlarmMessages%7D","TypeName":"VARDP","DPInfo":"%24%7BsysVarAlarmMessagesCount%7D","Value":0,"Timestamp":"1970-01-01 01:00:00","ValueMin":0,"ValueMax":65000,"ValueUnit":"","ValueType":16,"ValueSubType":0,"ValueList":""},
"41":{"Name":"%24%7BsysVarServiceMessages%7D","TypeName":"VARDP","DPInfo":"%24%7BsysVarServiceMessagesCount%7D","Value":0,"Timestamp":"1970-01-01 01:00:00","ValueMin":0,"ValueMax":65000,"ValueUnit":"","ValueType":16,"ValueSubType":0,"ValueList":""},
"1030":{"Name":"%24%7BsysVarAlarmZone1%7D","TypeName":"ALARMDP","DPInfo":"%24%7BsysVarAlarmZone1Msg%7D","Value":false,"Timestamp":"1970-01-01 01:00:00","ValueMin":null,"ValueMax":null,"ValueUnit":"","ValueType":2,"ValueSubType":6,"ValueList":"%24%7BsysVarAlarmZone1NotTriggered%7D%3B%24%7BsysVarAlarmZone1Triggered%7D"},
"950":{"Name":"%24%7BsysVarPresence%7D","TypeName":"VARDP","DPInfo":"%24%7BsysVarPresenceMsg%7D","Value":true,"Timestamp":"2021-10-02 18:30:46","ValueMin":null,"ValueMax":null,"ValueUnit":"","ValueType":2,"ValueSubType":2,"ValueList":"%24%7BsysVarPresenceNotPresent%7D%3B%24%7BsysVarPresencePresent%7D"},
"1032":{"Name":"DutyCycle","TypeName":"VARDP","DPInfo":"DutyCycle%20CCU","Value":-1.000000,"Timestamp":"2021-10-02 20:28:00","ValueMin":-1,"ValueMax":100,"ValueUnit":"%25","ValueType":4,"ValueSubType":0,"ValueList":""}}
2021-10-02 20:28:12.133 - info: hm-rega.0 (11728) got 0 programs
2021-10-02 20:28:12.151 - info: hm-rega.0 (11728) update rooms to enum.rooms
2021-10-02 20:28:12.293 - info: hm-rega.0 (11728) added/updated 0 programs
2021-10-02 20:28:12.297 - info: hm-rega.0 (11728) deleted 0 programs
2021-10-02 20:28:12.808 - info: hm-rpc.1 (11741) xmlrpc server is trying to listen on 192.168.1.230:42010
2021-10-02 20:28:12.810 - info: hm-rpc.1 (11741) xmlrpc client is trying to connect to 192.168.1.179:42010/ with ["http://192.168.1.230:42010","raspberrypi:hm-rpc.1"]
2021-10-02 20:28:12.824 - info: hm-rega.0 (11728) update functions to enum.functions
2021-10-02 20:28:12.904 - info: hm-rega.0 (11728) update favorites to enum.favorites
2021-10-02 20:28:12.911 - error: hm-rega.0 (11728) Could not synchronize favorites of user "": Error: The id "enum.favorites." is invalid. Ids are not allowed to end in "."
2021-10-02 20:28:42.987 - error: hm-rpc.1 (11741) Init not possible, going to stop: Unknown XML-RPC tag 'TITLE'
2021-10-02 20:29:12.879 - error: hm-rpc.1 (11741) Init not possible, going to stop: Unknown XML-RPC tag 'TITLE'
2021-10-02 20:29:12.991 - info: hm-rpc.1 (11741) xmlrpc -> 192.168.1.179:42010/ init ["http://192.168.1.230:42010",""]
2021-10-02 20:29:13.031 - error: hm-rpc.1 (11741) Cannot call init: [http://192.168.1.230:42010, ""] Unknown XML-RPC tag 'TITLE'
2021-10-02 20:29:13.042 - info: hm-rpc.1 (11741) terminating
2021-10-02 20:29:13.045 - info: hm-rpc.1 (11741) Terminated (NO_ERROR): Without reason
2021-10-02 20:29:14.185 - info: host.raspberrypi instance system.adapter.hm-rpc.1 terminated with code 0 (NO_ERROR)
2021-10-02 20:29:14.193 - info: host.raspberrypi Restart adapter system.adapter.hm-rpc.1 because enabled