Mercurial > code > home > repos > homeauto
view service/iot2/iot2_linux.nim @ 1700:11bd81eda1ef
release 0.12.0
author | drewp@bigasterisk.com |
---|---|
date | Tue, 12 Oct 2021 20:18:59 -0700 |
parents | e3eceee54937 |
children |
line wrap: on
line source
import nimpy proc setup_python(): PyObject = let sys = pyImport("sys") discard sys.path.extend([ ".", # for devices.py itself "build/py/lib/python3.7/site-packages" # for deeper imports ]) pyImport("devices") import json import osproc proc getSomeTemp(): float = let sensorsJson = execProcess("sensors", args=["-j"], options={poUsePath}) let res = parseJson(sensorsJson) res["coretemp-isa-0000"]["Core 0"]["temp2_input"].getFloat echo "iot2_linux starting" echo getSomeTemp() let devices = setup_python() discard devices.hello()