Historical data in web page is one hour ahead compared to PC clock
Ajut opened this issue · comments
Ajut commented
Hello,
My configuration:
- System: Kernel: 4.4.0-138-generic x86_64 (64 bit)
- Distro: Linux Mint 18.3 Sylvia
- yarn 1.13.0-1
- nodejs 11.6.0-1nodesource1
$ timedatectl
Local time: P 2019-01-13 13:42:18 EET
Universal time: P 2019-01-13 11:42:18 UTC
RTC time: P 2019-01-13 11:42:18
Time zone: Europe/Tallinn (EET, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Br,
Ajut
Ivan Fedulov commented
timezone is hardcoded here - https://github.com/fedulovivan/mhz19b/blob/master/public/index.html#L155
you can adjust it to match you local time
Ajut commented
*-> timezone is hardcoded here
- https://github.com/fedulovivan/mhz19b/blob/master/public/index.html#L155
<https://github.com/fedulovivan/mhz19b/blob/master/public/index.html#L155>->
you can adjust it to match you local time*
That was thre trick. Thanks :)!
*Question:* Any idea, what could cause checksum errors (see log below)?
…---
received bytes: <Buffer ff 86 01 e9 42 00 8b 02 c1>
*checksum error*
*crc 449*
receivedCrc 193
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 01 ea 42 00 8b 02 c0>
checksum error
crc 448
receivedCrc 192
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 01 dc 42 00 8b 02 ce>
checksum error
crc 462
receivedCrc 206
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 01 ee 42 00 8b 02 bc>
checksum error
crc 444
receivedCrc 188
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 01 f7 42 00 8b 02 b3>
checksum error
crc 435
receivedCrc 179
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 01 fd 42 00 8b 02 ad>
checksum error
crc 429
receivedCrc 173
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 01 ff 42 00 8b 02 ab>
checksum error
crc 427
receivedCrc 171
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 02 05 42 00 8c 02 a3>
measured ppm: 517 and temperature: 26
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 02 11 42 00 8c 02 97>
measured ppm: 529 and temperature: 26
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 02 0f 42 00 8c 02 99>
measured ppm: 527 and temperature: 26
sent bytes: <Buffer ff 01 86 00 00 00 00 00 79>
received bytes: <Buffer ff 86 02 18 42 00 8c 02 90>
measured ppm: 536 and temperature: 26--
On Sun, Jan 13, 2019 at 9:24 PM Ivan Fedulov ***@***.***> wrote:
timezone is hardcoded here -
https://github.com/fedulovivan/mhz19b/blob/master/public/index.html#L155
you can adjust it to match you local time
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AsfEzxUQ_H0VL_GKbc6cIDgOYIOV77kEks5vC4gCgaJpZM4Z9IDh>
.
Ivan Fedulov commented
Glad to observe you was able to launch my prototype code!
Most probably such errors are caused by bad electrical connections.
Try to reduce wires length, and solder wires instead using breadboard jumpers (if you do).
Ajut commented
*PS: *I like your server.js web output and wondering, how to modify it the
way, where it would be able read/implement data from my CSV file with
below listed structure.
*PS1: *Probably I would be able to understand and modify your JS files to
my needs easily, but unfortunately I'm not java developer :(
*Backround:* I changed USB UART controller with Wemos D1 Mini (WIFI UART
controller) and flashed with Tasmota FW (see: ->
https://github.com/arendst/Sonoff-Tasmota/wiki/Wemos-D1-Mini-and-MH-Z19B-CO2-Sensor
)
Now I'm able to read PPM and TEMP directly from web page provided by
Tasmota (see next bash script), but I'm unable to generate same structure
CSV as you currently using, because of there are two problems:
1. I'm not able to generate correct time stamp. Your's seems like
"date +%s" (seconds from 1970), but it gives only 10 position long string,
where yours gives 13 position long string (you adding also nanoseconds?).
2. I don't get, what for is "_id" value is needed and how to generate "_id"
values correctly (seems that server.js need it, don't show output if "_id"
values are empty ) and what for "_id" is used (guessing it's kind of index
like databases uses?)?
…---
#/bin/bash
LOG="/home/remote/sh/sonoff/mon_co2/co2.log"
CO2=`echo $(curl -s http://192.168.1.99/cm?cmnd=status%2008|jq -r
'.StatusSNS.MHZ19B.CarbonDioxide')`
TEMP=`echo $(curl -s http://192.168.1.99/cm?cmnd=status%2008|jq -r
'.StatusSNS.MHZ19B.Temperature')`
DATE=`echo $(date "+%Y-%m-%d;%H:%M:%S")`
while true
do
echo `date "+%Y-%m-%d;%H:%M:%S"`";"`curl -s
http://192.168.1.99/cm?cmnd=status%2008|jq -r
'.StatusSNS.MHZ19B.CarbonDioxide'`";"`curl -s
http://192.168.1.99/cm?cmnd=status%2008|jq -r
'.StatusSNS.MHZ19B.Temperature'` >>$LOG
sleep 300
done
---
---
remote@remote1:~/sh/sonoff/mon_co2$ cat co2.log
2019-01-29;21:02:22;795;21
2019-01-29;21:07:22;826;21
2019-01-29;21:12:24;826;21
2019-01-29;21:17:24;805;21
---
On Tue, Jan 29, 2019 at 11:29 AM Ivan Fedulov ***@***.***> wrote:
Glad to observe you was able to launch me prototype code!
Most probably such errors are caused by bad electrical connections.
Try to reduce wires length, and solder wires instead using breadboard
jumpers (if you do).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AsfEzxawibQwpG4MbOgoUneFx0rueh09ks5vIBRygaJpZM4Z9IDh>
.
Ajut commented
Never mind, at the end I was able to generate suitable timestamp with
"date +%%3N" and used same values also for "_id" and stated to generate
stroage.db at the same format as your code does. So now your server.js is
able to serve my storage.db generated by my bash script :)
…On Wed, Jan 30, 2019 at 3:05 PM Ajut Surra ***@***.***> wrote:
*PS: *I like your server.js web output and wondering, how to modify it
the way, where it would be able read/implement data from my CSV file with
below listed structure.
*PS1: *Probably I would be able to understand and modify your JS files to
my needs easily, but unfortunately I'm not java developer :(
*Backround:* I changed USB UART controller with Wemos D1 Mini (WIFI UART
controller) and flashed with Tasmota FW (see: ->
https://github.com/arendst/Sonoff-Tasmota/wiki/Wemos-D1-Mini-and-MH-Z19B-CO2-Sensor
)
Now I'm able to read PPM and TEMP directly from web page provided by
Tasmota (see next bash script), but I'm unable to generate same structure
CSV as you currently using, because of there are two problems:
1. I'm not able to generate correct time stamp. Your's seems like
"date +%s" (seconds from 1970), but it gives only 10 position long string,
where yours gives 13 position long string (you adding also nanoseconds?).
2. I don't get, what for is "_id" value is needed and how to generate
"_id" values correctly (seems that server.js need it, don't show output if
"_id" values are empty ) and what for "_id" is used (guessing it's kind of
index like databases uses?)?
---
#/bin/bash
LOG="/home/remote/sh/sonoff/mon_co2/co2.log"
CO2=`echo $(curl -s http://192.168.1.99/cm?cmnd=status%2008|jq
<http://192.168.1.99/cm?cmnd=status%2008%7Cjq> -r
'.StatusSNS.MHZ19B.CarbonDioxide')`
TEMP=`echo $(curl -s http://192.168.1.99/cm?cmnd=status%2008|jq
<http://192.168.1.99/cm?cmnd=status%2008%7Cjq> -r
'.StatusSNS.MHZ19B.Temperature')`
DATE=`echo $(date "+%Y-%m-%d;%H:%M:%S")`
while true
do
echo `date "+%Y-%m-%d;%H:%M:%S"`";"`curl -s
http://192.168.1.99/cm?cmnd=status%2008|jq
<http://192.168.1.99/cm?cmnd=status%2008%7Cjq> -r
'.StatusSNS.MHZ19B.CarbonDioxide'`";"`curl -s
http://192.168.1.99/cm?cmnd=status%2008|jq
<http://192.168.1.99/cm?cmnd=status%2008%7Cjq> -r
'.StatusSNS.MHZ19B.Temperature'` >>$LOG
sleep 300
done
---
---
***@***.***:~/sh/sonoff/mon_co2$ cat co2.log
2019-01-29;21:02:22;795;21
2019-01-29;21:07:22;826;21
2019-01-29;21:12:24;826;21
2019-01-29;21:17:24;805;21
---
On Tue, Jan 29, 2019 at 11:29 AM Ivan Fedulov ***@***.***>
wrote:
> Glad to observe you was able to launch me prototype code!
> Most probably such errors are caused by bad electrical connections.
> Try to reduce wires length, and solder wires instead using breadboard
> jumpers (if you do).
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AsfEzxawibQwpG4MbOgoUneFx0rueh09ks5vIBRygaJpZM4Z9IDh>
> .
>
Ivan Fedulov commented