For more information,please visit https://qiita.com/revsystem/items/76ab1e21d386c5977892 (in Japanese.)
sudo raspi-config
5 Interfacing Option
-> P6 Serial
Would you like a login shell to be accessible over serial?
-> No
Would you like the serial port hardware to be enabled?
-> Yes
sudo pip3 install mh-z19
sudo apt-get install jq ruby
You can get CO2 value with below command.
sudo python3 -m mh_z19
{"co2": 398}
sudo python3 -m mh_z19 --all
{"co2": 383, "temperature": 26, "TT": 66, "SS": 0, "UhUl": 0}
[plugin.metrics.co2]
command = "ruby /home/pi/mackerel/mh_z19_monitoring.rb"
env = { MONITOR = "co2" }
[plugin.metrics.temp]
command = "ruby /home/pi/mackerel/mh_z19_monitoring.rb"
env = { MONITOR = "temperature" }
command reference: https://pypi.org/project/mh-z19/
Calibration reference: https://github.com/UedaTakeyuki/mh-z19/wiki/CALIBRATION-&-detection-range