ams client
jiioryo / ams-client Goto Github PK
View Code? Open in Web Editor NEWams client
License: MIT License
ams client
License: MIT License
Reboot中はデバイス全部オフになってるからそれに対応させる。 reboot するまえに全部消してデバイスステートpublish
******************************
ERROR!
Traceback (most recent call last):
File "ams_client.py", line 34, in main
publish_sensor_data()
File "/home/pi/ams-client/service/sensor.py", line 86, in publish_sensor_data
a, b = least_squares( sensor['sensor']['calibration'] )
File "/home/pi/ams-client/lib/util.py", line 38, in least_squares
a = (N * sum_xy - sum_x * sum_y)/float(N * sum_x2 - sum_x ** 2)
ZeroDivisionError: float division by zero
******************************
やること
cp [サンプルのsetting系json]
mkdir log
mkdir log/logger
mkdir log/tmp
crontab の登録
# AMS
@reboot cd /home/pi/ams-client && python3 ams_client.py
* * * * * cd /home/pi/ams-client && python3 entry_points/unsent_log_sender.py
* * * * * cd /home/pi/ams-client && python3 entry_points/cameras.py
topic routerの後すぐ
getDevices
getDeviceStateとややこしいし、
sensorはgetSensors, getSensorsSettingだから、統一感がない
local管理画面のデバイスupdateのときに、なんかバグる
slackとか投稿しようとする時ブロッキングする。
非同期にしたい。
@reboot
書く必要ある
requestのlistが正しいか確認
continuousとfeed pumpが急に入れ替わったら、ヤバイ
おそらくsensor data をgetしようとした時
Traceback (most recent call last):
File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
StopIteration: 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/.local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/.local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/.local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/pi/ams-client/server/app.py", line 100, in get_sensor_value
current_sensor_values = get_current_sensor_values()
File "/home/pi/ams-client/service/sensor.py", line 48, in get_current_sensor_values
current_sensor_values = json.load(f)
File "/usr/lib/python3.7/json/__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
runtypeの
debug用のprintのことだと思うけど、まあ暇だったらでいいや
雑なloggerつくる
ボタン押したらメニューの一覧がでてくるかんじ
エラーとかで止まらないようにいいかんじにハンドリング必要
hourをhoueとか許可するなるとバグる ー> optionをそのままぶち込んでるから
2 4 8 16 32 ...
回ごとにslack通知’する’ようにする
今度やる
selectedCameraがリセットされないから、新規登録時にフォームに前洗濯していたカメラが入ってしまう
ネットワークに繋がるまでの予想時間、一定時間待ってから接続しようとする。
失敗したら止まる。
wait timeやめて一定秒おきにリトライするようにする。
多分やらないやつ
覚えてないけど(index.htmlがどこー?ってなる)
たぶん
データが消えた時にtemplateからコピーしたりするの面倒
local serverの管理画面上からダウンロードできると
新しい環境に移行した時とかに便利かも
ams-cameraのAPIを叩くやつ
cd ams-clientする??
こないだ作った絶対パスをつかう?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.