LWPM Comfort Module

  • Status Closed
  • Percent Complete
    100%
  • Task Type Pozostałe
  • Category Konfigurator
  • Assigned To
    LWPM
  • Operating System wszystkie
  • Priority Very Low
  • Reported Version v0.3
  • Due in Version Undecided
  • Votes 2
  • Private
Attached to Project: LWPM Comfort Module
Opened by Łukasz Ostapiuk - 25.09.2018
Last edited by LWPM - 09.11.2018

FS#181 - Konfiguracja przez linuxa

Jak uruchomić lcm_service.exe pod Linuxem

Instrukcja jest przygotowana w oparciu o system Debian/Ubuntu.
W innych systemach będzie podobnie, choć polecenia mogą być inna. Nazwy pakietów również mogą się różnić

Wymagania systemowe

  • python3.5+

Przygotowanie systemu

1. Instalujemy następujące pakiety w systemie: python3-pip

apt-get install python3-pip

2. instalujemy pakiety pythona: flask, flask-cors, pyserial

pip3 install flask
pip3 install flask-cors
pip3 install pyserial

Uruchomienie lcm_service.py

Plik lcm-service.py pobieramy z tego adresu: https://files.lwpm.eu/LWPMComfortModule/lcm_service.py i uruchamiamy z konsoli:

./lcm_service.py

Opcjonalne parametry:
–debug - wyświetlanie informacji debugowych usługi
–debug-uart - zrzut całej komunikacji UART do konsoli
–ssl - użycie szyfrowanej komunikacji z usługą
–dump - zrzut całej komunikacji HTTP do konsoli

Closed by  LWPM
09.11.2018 13:27
Reason for closing:  Zrobione
Łukasz Ostapiuk commented on 26.09.2018 16:06

Witam

Jakieś info? :)

Admin
LWPM commented on 30.10.2018 15:24

zastanawiam się... czego tutaj oczekujesz w instrukcji?
jak uruchomić lcm_service.py na Linuxie? czy co?

Łukasz Ostapiuk commented on 30.10.2018 15:33

Właśnie nie wiem co trzeba uruchomić, choć po zabawie z  bug 182  już wiem wszystko.

Mógłbyś wrzucić tu plik lub wskazać skąd można go pobrać?

Łukasz Ostapiuk commented on 31.10.2018 08:21

Mógłbym prosić o ten plik :)

lcm_service.py

Admin
LWPM commented on 05.11.2018 11:50
Łukasz Ostapiuk commented on 05.11.2018 18:55

Mam coś takiego przy próbie odpalenia.

xxx@xxx:~/Pulpit/tools$ su root
Hasło:
root@xxx:/home/xxx/Pulpit/tools# python3 lcm_service.py
Traceback (most recent call last):

File "lcm_service.py", line 16, in 
  from flask import Flask, jsonify, request, redirect

ImportError: No module named 'flask'
root@xxx:/home/xxx/Pulpit/tools# lsusb
Bus 001 Device 003: ID 0c45:62c0 Microdia Sonix USB 2.0 Camera
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 03f0:171d Hewlett-Packard Bluetooth 2.0 Interface [Broadcom BCM2045]
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 004: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
root@xxx:/home/xxx/Pulpit/tools#

Admin
LWPM commented on 06.11.2018 13:12

skoro widać, że nie ma flask, to trzeba go zainstalować

pip3 install flask
Łukasz Ostapiuk commented on 06.11.2018 13:15

;) no tak

Ostatnio mało śpię, nie pomyślałem ;)

Dzięki

Łukasz Ostapiuk commented on 06.11.2018 18:52

Niestety coś nadal jest nie tak

xxx@xxx:~/Pulpit/tools$ su root
Hasło:
root@xxx:/home/xxx/Pulpit/tools# python3 lcm_service.py

LWPM Comfort Module - usługa (v1.0, API: v1.0 rev 8)

Ten program wymagany jest do skonfigurowania/aktualizacji modułu komfortu do

Astry-H / Zafiry-B / Vectry-C / Signum / Corsa-D / Antara

Konfigurator jest dostępny na stronie https://lwpm.eu/comfort/

Usługa została uruchomiona na adresie http://127.0.0.1:50099/api/

Po skończonej pracy możesz bezpiecznie zamknąć to okno.

* Serving Flask app "lcm_service" (lazy loading)
* Environment: production

 WARNING: Do not use the development server in a production environment.
 Use a production WSGI server instead.

* Debug mode: off

init API session

get device list

select device

identify device

DEV> Connecting to device /dev/ttyUSB0...
DEV> Device initialization...
DEV> –> connection succeeded
DEV> –> connecting with service succeeded
DEV> –> device identification...
DEV> Device: LWPM Comfort Module
DEV> Version: v0.4
DEV> Firmware: 2018-10-25/lcm/df60633
DEV> Boot: v1.2
DEV> Hardware revision: v1.0
DEV> Hardware type: DPF Monitor
DEV> Serial number: DPF/F6490906
DEV> Manufacturing date: 2017-11-27
DEV> License owner: palibrzuch
DEV> License features: 0, 1, 3, 4, 5, 6, 7, 9
DEV> Firmware type: 0, 1
DEV> –> return to normal device mode...
DEV> –> OK
DEV> Disconnecting device...

read configuration

DEV> Connecting to device /dev/ttyUSB0...

init license manager

DEV> Device initialization...
DEV> –> connection succeeded
DEV> –> connecting with service succeeded
DEV> –> read configuration...
DEV> –> device configuration read...
DEV> –> return to normal device mode...
DEV> –> OK
DEV> Disconnecting device...

identify device

DEV> Connecting to device /dev/ttyUSB0...
DEV> Device initialization...
DEV> –> connection succeeded
DEV> –> connecting with service succeeded
DEV> –> device identification...
DEV> Device: LWPM Comfort Module
DEV> Version: v0.4
DEV> Firmware: 2018-10-25/lcm/df60633
DEV> Boot: v1.2
DEV> Hardware revision: v1.0
DEV> Hardware type: DPF Monitor
DEV> Serial number: DPF/F6490906
DEV> Manufacturing date: 2017-11-27
DEV> License owner: palibrzuch
DEV> License features: 0, 1, 3, 4, 5, 6, 7, 9
DEV> Firmware type: 0, 1
DEV> –> return to normal device mode...
DEV> –> OK
DEV> Disconnecting device...

read configuration

DEV> Connecting to device /dev/ttyUSB0...

init license manager

DEV> Device initialization...
DEV> –> connection succeeded
DEV> –> connecting with service succeeded
DEV> –> read configuration...
DEV> –> device configuration read...
DEV> –> return to normal device mode...
DEV> –> OK
DEV> Disconnecting device...

write configuration

[2018-11-06 19:52:11,625] ERROR in app: Exception on /api/v1/81ab84bdf4a06d629905e835f6fd880a/config/write [GET]
Traceback (most recent call last):

File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2292, in wsgi_app
  response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1815, in full_dispatch_request
  rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask_cors/extension.py", line 161, in wrapped_function
  return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1718, in handle_user_exception
  reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 35, in reraise
  raise value
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1813, in full_dispatch_request
  rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1799, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
File "lcm_service.py", line 496, in inner
  js = f(*a, **k)
File "lcm_service.py", line 1001, in config_write
  configuration = loads(b64decode(request.args['POSTDATA']))
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
  s.__class__.__name__))

TypeError: the JSON object must be str, not 'bytes'

Admin
LWPM commented on 06.11.2018 19:39

Pewien nie jestem, ale... Spróbuj z pythonem 3.6

Admin
LWPM commented on 06.11.2018 22:37

Pokaż co pokazuje

pip3 list
Łukasz Ostapiuk commented on 07.11.2018 07:27

root@xxx:/home/xxx/Pulpit/tools# pip3 list
apturl (0.5.2)
beautifulsoup4 (4.4.1)
blinker (1.3)
Brlapi (0.6.4)
can (2.0)
chardet (2.3.0)
checkbox-support (0.22)
Click (7.0)
command-not-found (0.3)
cryptography (1.2.3)
defer (1.0.6)
feedparser (5.1.3)
Flask (1.0.2)
Flask-Cors (3.0.6)
guacamole (0.9.2)
html5lib (0.999)
httplib2 (0.9.1)
idna (2.0)
itsdangerous (1.1.0)
Jinja2 (2.10)
language-selector (0.1)
louis (2.6.4)
lxml (3.5.0)
Mako (1.0.3)
MarkupSafe (0.23)
oauthlib (1.0.3)
onboard (1.2.0)
padme (1.1.1)
pexpect (4.0.1)
Pillow (3.1.2)
pip (8.1.1)
plainbox (0.25)
ptyprocess (0.5)
pyasn1 (0.1.9)
pycups (1.9.73)
pycurl (7.43.0)
pygobject (3.20.0)
PyJWT (1.3.0)
pyparsing (2.0.3)
pyserial (3.4)
python-apt (1.1.0b1+ubuntu0.16.4.3)
python-can (3.0.0)
python-debian (0.1.27)
python-systemd (231)
pyxdg (0.25)
reportlab (3.3.0)
requests (2.9.1)
sessioninstaller (0.0.0)
setuptools (20.7.0)
six (1.10.0)
system-service (0.3)
typing (3.6.6)
ubuntu-drivers-common (0.0.0)
ufw (0.35)
unattended-upgrades (0.1)
unity-scope-calculator (0.1)
unity-scope-chromiumbookmarks (0.1)
unity-scope-colourlovers (0.1)
unity-scope-devhelp (0.1)
unity-scope-firefoxbookmarks (0.1)
unity-scope-gdrive (0.7)
unity-scope-manpages (0.1)
unity-scope-openclipart (0.1)
unity-scope-texdoc (0.1)
unity-scope-tomboy (0.1)
unity-scope-virtualbox (0.1)
unity-scope-yelp (0.1)
unity-scope-zotero (0.1)
urllib3 (1.13.1)
usb-creator (0.3.0)
Werkzeug (0.14.1)
wheel (0.29.0)
wrapt (1.10.11)
xdiagnose (3.8.4.1)
xkit (0.0.0)
XlsxWriter (0.7.3)

Admin
LWPM commented on 07.11.2018 07:54

Problemem jest faktycznie Python 3.5

Poprawię to tak by działało z 3.5

Cierpliwości...

Łukasz Ostapiuk commented on 07.11.2018 08:07

Spokojnie, na razie działa na win i jest ok

Admin
LWPM commented on 07.11.2018 13:24

spróbuj jeszcze raz ściągnąć lcm_service.py i sprawdź na python 3.5 - ja nie sprawdzałem :)
ale powinno działać.

Łukasz Ostapiuk commented on 07.11.2018 17:54

DEV> Connecting to device /dev/ttyUSB0...
DEV> Device initialization...
DEV> –> connection succeeded
DEV> –> connecting with service succeeded
DEV> –> writing configuration...
DEV> –> device configuration write...
DEV> –> OK
DEV> –> return to normal device mode...
DEV> –> OK
DEV> Disconnecting device...

Jest ok :)

Łukasz Ostapiuk commented on 08.11.2018 10:00

Dodam, że musiałem jeszcze zainstalować flask-core

Łukasz Ostapiuk commented on 08.11.2018 10:01

flask-cors oczywiście

Admin
LWPM commented on 08.11.2018 10:02

rzuć okiem na instrukcję i daj znać co poprawić, dopisać

Łukasz Ostapiuk commented on 08.11.2018 10:08

Jest ok ;) będzie trybić ;)

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing