【文件属性】:
文件名称:termo-api:DIY恒温器的API
文件大小:13KB
文件格式:ZIP
更新时间:2021-07-13 08:54:54
Go
术语API
用于 DIY 互联网控制恒温器的基于的 API。
硬件
- Raspberry Pi(B 型) - Sainsmart 4 继电器模块 - DS18B20 温度传感器
依赖关系
一个 Go 网络框架。
一个 Go GPIO 库。
是用于此 API 的 EmberJS 驱动的 UI。
构建(在 OS X 10.9.5 上)
下载并挂载 arm5 交叉编译
$ script/build_for_pi
注意:仅当存在 cgo 依赖项时才需要工具链。
部署
创建./api_key参见./api_key.example
根据需要编辑script/deploy变量
$ script/deploy
注意:目前 termo-api 以 root 身份部署,以便与 GPIO 引脚接口,这很糟糕,很快就会修复。
开始
$ API_KEY=foo ./termo-api
问题
权限
【文件预览】:
termo-api-master
----.gitignore(307B)
----fakes.go(503B)
----termo_api_suite_test.go(241B)
----build()
--------.gitkeep(0B)
----db()
--------201411151620_create_db.sql(143B)
----schedule.go(2KB)
----thermostat.go(897B)
----scheduler.go(660B)
----LICENSE.txt(1KB)
----api_test.go(4KB)
----main.go(1KB)
----README.md(1KB)
----api_key.example(13B)
----script()
--------db_setup(235B)
--------build_for_pi(203B)
--------db_drop(142B)
--------deploy(751B)
--------develop(131B)
----schedule_test.go(4KB)
----heater.go(905B)
----api.go(2KB)
----thermometer.go(1KB)
----database.go(785B)