Good! I will examine this, and as a next step in my installation implement this as a monthly log of all weather data (inside and out…) so I can make a comparison in the same month next year.
-
monthly logging in external file
-
yes, also possible… but i think you should collect daily temperatures at a certain time for a accurate evaluation so you did not need the date-comparison-part
-
True! But a good point to start from!
Thx. -
This post is deleted!
-
@xCite86
Your description for writing to a log file is very interesting. Very nice work of yours.
Unfortunately, I can’t figure out how to do it. The GUI certainly doesn’t work at all. Therefore I tried to do it directly in the config. Unfortunately, I lack too much knowledge to find my mistakes. I have added the following in the config:{ "id": "logfile", "name": "Logfile", "rule": "when its 23:58 and $date_today.todaydate = $date_lastdayofmonth.lastdayofmonth then execute \"sudo sed -i '\$ a Gas Tag $date_today.todaydate $gas-zahler.Gas heute Kubikmeter' /home/pi/energycounter.log and and execute \"sudo sed -i '\$ a Gas Gesamt $date_today.todaydate $zaehler Kubikmeter' /home/pi/energycounter.log and and execute \"sudo sed -i '\$ a #################################' /home/pi/energycounter.log", "active": false, "logging": true },
Can you tell me where my mistakes lie? Or how it has to look right.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
-
Hello, can’t anyone help me with this problem?
No matter what I try to do with the “sed command”, I always get an error with the sart of pimatic.If my rule looks like this:
{ "id": "logfile", "name": "LogFile", "rule": "when its 23:58 and $date_today.todaydate = $date_lastdayofmonth.lastdayofmonth then execute "sudo sed -i '\$ a sometext $zaehler' /home/pi/energycounter.log"", "active": true, "logging": true }
Then I get these errors at startup:
3:00:32.724 2018-03-03 Saturday 13:00:37.940 [pimatic] Starting pimatic version 0.9.42 13:00:38.230 [pimatic] Startup error: SyntaxError: Unexpected character: '; input: '\$ a sometext $zaehler' /home/pi/energycounter.log"", 13:00:38.230 [pimatic]> "active": true, 13:00:38.230 [pimatic]> "logging": true 13:00:38.230 [pimatic]> 13:00:38.230 [pimatic]> at /home/pi/pimatic-app/node_modules/pimatic/node_modules/relaxed-json/relaxed-json.js:70:21 13:00:38.230 [pimatic]> at Object.transform (/home/pi/pimatic-app/node_modules/pimatic/node_modules/relaxed-json/relaxed-json.js:232:18) 13:00:38.230 [pimatic]> at Framework._loadConfig (/home/pi/pimatic-app/node_modules/pimatic/lib/framework.coffee:143:39) 13:00:38.230 [pimatic]> at new Framework (/home/pi/pimatic-app/node_modules/pimatic/lib/framework.coffee:61:8) 13:00:38.230 [pimatic]> at /home/pi/pimatic-app/node_modules/pimatic/startup.coffee:94:17 13:00:38.230 [pimatic]> at tryCatcher (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/util.js:16:23) 13:00:38.230 [pimatic]> at Function.Promise.attempt.Promise.try (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/method.js:39:29) 13:00:38.230 [pimatic]> at Object.startup (/home/pi/pimatic-app/node_modules/pimatic/startup.coffee:93:10) 13:00:38.230 [pimatic]> at run (/home/pi/pimatic-app/node_modules/pimatic/pimatic.js:15:24) 13:00:38.230 [pimatic]> at Object.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic/pimatic.js:20:3) 13:00:38.230 [pimatic]> at Module._compile (module.js:409:26) 13:00:38.230 [pimatic]> at Object.Module._extensions..js (module.js:416:10) 13:00:38.230 [pimatic]> at Module.load (module.js:343:32) 13:00:38.230 [pimatic]> at Function.Module._load (module.js:300:12) 13:00:38.230 [pimatic]> at Function.Module.runMain (module.js:441:10) 13:00:38.230 [pimatic]> at startup (node.js:139:18) 13:00:38.230 [pimatic]> at node.js:990:3 13:00:38.234 [pimatic] exiting...
And I’m too stupid to find the mistake.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
-
@thrusty said in monthly logging in external file:
And I’m too stupid to find the mistake.
The problem is caused by the double quotes enclosing the execute command as these must be escaped. You can avoid these problems to an large extent by using the the rule editor. If you want to get that fixed in the config file the following should work:
"rule": "when its 23:58 and $date_today.todaydate = $date_lastdayofmonth.lastdayofmonth then execute \"sudo sed -i '\$ a sometext $zaehler' /home/pi/energycounter.log\"",
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig
Thank you for your prompt help and answer.
I’m afraid that doesn’t work for me. I get about the same mistake as before.
What should it look like when I type it into the GUI?
What signs must I leave out? I need only the “then” section."Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
-
@thrusty Sorry, I didn’t test it and overlooked more escaping is required. Please try the following and possibly use the rule editor next time.
"rule": "when edimax-smartplug is turned on then execute \"sudo sed -i '\\$ a sometext $zaehler' /home/pi/energycounter.log\"",
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig
Really very nice, it works.
Thanks.
If even just a comma, slash, backslash whatever is wrong. Then I’m done for."Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)