Merge pull request #171 from flobz/develop

Develop
This commit is contained in:
Florian BEZANNIER
2021-07-01 19:54:52 +02:00
committed by GitHub
6 changed files with 28 additions and 22 deletions
+17 -10
View File
@@ -1,13 +1,20 @@
FROM python:3-slim
ARG TARGETPLATFORM
ARG PYTHON_DEP='python3 python3-wheel python3-typing-extensions python3-pandas python3-plotly python3-six python3-dateutil python3-brotli python3-pycryptodome libatlas3-base python3-cryptography python3-scipy androguard'
FROM debian:buster-slim AS builder
ARG PYTHON_DEP
RUN BUILD_DEP='python3-pip python3-setuptools python3-dev libblas-dev liblapack-dev gfortran libatlas3-base' ; \
apt-get update && apt-get install -y --no-install-recommends $BUILD_DEP $PYTHON_DEP;
COPY . /psa_car_controller/
WORKDIR /config
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then apt-get update && apt-get install -y gcc && apt-get clean ; \
rm -rf /var/lib/apt/lists/* ; fi ; \
pip3 install --no-cache-dir -r /psa_car_controller/requirements.txt ; \
apt-get remove -y gcc 2> /dev/null ; \
apt-get autoremove -y
RUN pip3 install --system --no-cache-dir -r /psa_car_controller/requirements.txt
EXPOSE 5000
RUN chmod +x /psa_car_controller/docker_files/init.sh
FROM debian:buster-slim
ARG PYTHON_DEP
WORKDIR /config
ENV PSACC_BASE_PATH=/ PSACC_PORT=5000 PSACC_OPTIONS="-c -r --web-conf" PSACC_CONFIG_DIR="/config"
CMD /psa_car_controller/docker_files/init.sh
COPY --from=builder /var/lib/apt /var/lib/apt
COPY --from=builder /var/cache/apt/ /var/cache/apt/
COPY --from=builder /usr/local/lib /usr/local/lib
RUN apt-get install -y --no-install-recommends $PYTHON_DEP && apt-get clean ; rm -rf /var/lib/apt/lists/*
COPY . /psa_car_controller/
CMD /psa_car_controller/docker_files/init.sh
+3 -3
View File
@@ -85,16 +85,16 @@ If you have a special price during the night you can set "night price", "night h
Hours need to be in the following format "23h12"?
You can modify a price manually in the dashboard. It can be useful if you use public charge point.
## V. Connect your home automation system:
## V. Connection to other services:
- [Domoticz](docs/domoticz/Domoticz.md)
- [HomeAssistant](https://github.com/Flodu31/HomeAssistant-PeugeotIntegration)
- Jeedom (Anyone can share the procedure ?)
- You can send live car status to ABRP (A better Route Planner), see [this page](docs/abrp.md)
- [Grafana](https://github.com/flobz/psa_car_controller/issues/161)
## FAQ
If you have a problem, or a question please check if the answer isn't in the [FAQ](FAQ.md).
If you need information to contribute or edit this program go [here](docs/Develop.md).
## Connect to A better Route Planner
You can connect the app to ABRP, see [this page](docs/abrp.md)
## Donation
If you want to thank me for my work :smile:
+1 -5
View File
@@ -113,7 +113,6 @@ def firstLaunchConfig(package_name, client_email, client_password, country_code,
psacc.connect(client_email, client_password)
psacc.save_config(name=config_prefix + "config.json")
res = psacc.get_vehicles()
print(f"\nYour vehicles: {res}")
if len(res) == 0:
Exception("No vehicle in your account is compatible with this API, you vehicle is probably too old...")
@@ -122,12 +121,9 @@ def firstLaunchConfig(package_name, client_email, client_password, country_code,
car = psacc.vehicles_list.get_car_by_vin(vehicle["vin"])
if car is not None and "short_label" in vehicle and car.label == "unknown":
car.label = vehicle["short_label"].split(" ")[-1] # remove new, nouvelle, neu word....
car.set_energy_capacity()
else:
print("Warning: Can't get car model for please check cars.json")
psacc.vehicles_list.save_cars()
print(f"\nYour vehicles: {res}")
logger.info("\nYour vehicles: %s", res)
# Charge control
charge_controls = ChargeControls(config_prefix + "charge_config.json")
Regular → Executable
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash
echo "Containerised psa_car_controller loading..."
cd "$PSACC_CONFIG_DIR"
python3 /psa_car_controller/server.py -p "$PSACC_PORT" -l 0.0.0.0 -b "$PSACC_BASE_PATH" "$PSACC_OPTIONS"
ARGS="-p $PSACC_PORT -l 0.0.0.0 -b $PSACC_BASE_PATH $PSACC_OPTIONS"
python3 /psa_car_controller/server.py $ARGS
+3 -1
View File
@@ -68,5 +68,7 @@ carmodels = [
CarModel("C5 Aircross", 10.8, 43),
CarModel("DS7 Crossback E-Tense", 11.5, 43, reg="VR1J45GBUK.*"),
CarModel("DS7 Crossback E-Tense 300 4x4", 11.5, 43, reg=" VR1J45GBUL.*"),
CarModel("508 SW Hybrid", 11.5, 45, reg=r"VR3F4DGZ.*") # VR3F4DGZTL
CarModel("508 SW Hybrid", 11.5, 45, reg=r"VR3F4DGZ.*"), # VR3F4DGZTL
CarModel("Grandland X Hybrid", 13.2, 43, reg=r"W0VZ4DGZ.*"), #W0VZ4DGZ2L
CarModel("Grandland X Hybrid 4x4", 13.2, 43, reg=r"W0VZ45GB.*") #W0VZ45GB3L
]
+2 -2
View File
@@ -25,7 +25,7 @@ config_layout = dbc.Row(dbc.Col(className="col-md-12 col-lg-2 ml-2", children=[
{"label": "Opel", "value": "com.psa.mym.myopel"},
{"label": "Citroën", "value": "com.psa.mym.citroen"},
{"label": "DS", "value": "com.psa.mym.myds"},
{"label": "Vauxhall", "value": "com.psa.mym.myvauxhll"}
{"label": "Vauxhall", "value": "com.psa.mym.myvauxhall"}
],
)]),
dbc.FormGroup(
@@ -61,7 +61,7 @@ config_layout = dbc.Row(dbc.Col(className="col-md-12 col-lg-2 ml-2", children=[
placeholder="Enter your country code",
),
dbc.FormText(
"Example: FR for FRANCE or GB for United Kingdom",
"Example: FR for FRANCE or GB for Great Britain...",
color="secondary",
)
]