Giter Club home page Giter Club logo

ams-client's Introduction

ams-client

ams client

ams-client's People

Contributors

jiioryo avatar

Watchers

 avatar  avatar

ams-client's Issues

最小二乗法の計算をするときにデータ一個しかないとエラーになる

******************************
           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
******************************

init.sh(py?)の作成

やること

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

変数名渋いシリーズ

getDevices
getDeviceStateとややこしいし、
sensorはgetSensors, getSensorsSettingだから、統一感がない

exchange validation

requestのlistが正しいか確認

  • そのdevice_idが存在するか。
  • lengthが正しいか。

このエラーどうにかする。

おそらく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)


Network wait timeの実装をどうにかする

ネットワークに繋がるまでの予想時間、一定時間待ってから接続しようとする。
失敗したら止まる。

wait timeやめて一定秒おきにリトライするようにする。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.