Mercurial > code > home > repos > homeauto
view service/iot2/iot2_linux.nim @ 696:c52b172c0824
add publish to ON/OFF messages. split up the main statement handler
Ignore-this: b1ec515e6873a6841b1c31c3fb7a2a36
author | drewp@bigasterisk.com |
---|---|
date | Fri, 31 Jan 2020 23:55:27 -0800 |
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()