view service/iot2/iot2_linux.nim @ 1512:1e9cfec1be78

don't require first arg on PatchedGraph.serialize Ignore-this: bc695823e03dbd012e03efa4e40b6aca darcs-hash:1dbf9271b5ca55c78987c474ef223af9d5b811d2
author drewp <drewp@bigasterisk.com>
date Mon, 03 Feb 2020 23:46:29 -0800
parents 455b1b80516e
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()