diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 05:47:42 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 05:47:42 +0000 |
| commit | 2a085348adfe976e318489a60e2de51e7edcda0e (patch) | |
| tree | f10a1f881a0af33cb4cee61664bc53e674480658 /python-volkswagencarnet.spec | |
| parent | ce17e5b0dd69e6268f4db93a5cd669d17cdcea6e (diff) | |
automatic import of python-volkswagencarnetopeneuler20.03
Diffstat (limited to 'python-volkswagencarnet.spec')
| -rw-r--r-- | python-volkswagencarnet.spec | 550 |
1 files changed, 550 insertions, 0 deletions
diff --git a/python-volkswagencarnet.spec b/python-volkswagencarnet.spec new file mode 100644 index 0000000..db7415c --- /dev/null +++ b/python-volkswagencarnet.spec @@ -0,0 +1,550 @@ +%global _empty_manifest_terminate_build 0 +Name: python-volkswagencarnet +Version: 4.4.59 +Release: 1 +Summary: Communicate with Volkswagen WeConnect +License: GPLv3 +URL: https://github.com/robinostlund/volkswagencarnet +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/7d/25/b19fcb6fa9e4e6349b59481ba876c8fe950efbdc627e9a20233163685945/volkswagencarnet-4.4.59.tar.gz +BuildArch: noarch + +Requires: python3-lxml +Requires: python3-beautifulsoup4 +Requires: python3-aiohttp +Requires: python3-pyjwt + +%description +# Volkswagen Carnet + +[](https://www.buymeacoffee.com/robinostlund) + + + + + + +[](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml) +[](https://codecov.io/gh/robinostlund/volkswagencarnet) + + + + + + +## Information + +Retrieve statistics about your Volkswagen from the Volkswagen Carnet online service + +No licence, public domain, no guarantees, feel free to use for anything. Please contribute improvements/bugfixes etc. + +## Thanks to + +- [Wez3](https://github.com/wez3) +- [Reneboer](https://github.com/reneboer) +- [Tubalainen](https://github.com/tubalainen) +- [JohNan](https://github.com/JohNan) +- [milkboy](https://github.com/milkboy) + +For supporting and helping in this project. + +## Other related repositories + +- [HomeAssistant Component](https://github.com/robinostlund/homeassistant-volkswagencarnet) a custom component for Home Assistant + +## Installation + +```sh +[venv-python3] user@localhost:~ +$ pip install volkswagencarnet +``` + +### Example + +```python +#!/usr/bin/env python3 +from volkswagencarnet.vw_connection import Connection +import pprint +import asyncio +import logging + +from aiohttp import ClientSession + +logging.basicConfig(level=logging.DEBUG) + +VW_USERNAME='test@example.com' +VW_PASSWORD='mysecretpassword' + + +COMPONENTS = { + 'sensor': 'sensor', + 'binary_sensor': 'binary_sensor', + 'lock': 'lock', + 'device_tracker': 'device_tracker', + 'switch': 'switch', + 'climate': 'climate' +} + +RESOURCES = [ + 'position', + 'distance', + 'electric_climatisation', + 'combustion_climatisation', + 'window_heater', + 'combustion_engine_heating', + 'charging', + 'adblue_level', + 'battery_level', + 'fuel_level', + 'service_inspection', + 'oil_inspection', + 'last_connected', + 'charging_time_left', + 'electric_range', + 'combustion_range', + 'combined_range', + 'charge_max_ampere', + 'climatisation_target_temperature', + 'external_power', + 'parking_light', + 'climatisation_without_external_power', + 'door_locked', + 'trunk_locked', + 'request_in_progress', + 'windows_closed', + 'sunroof_closed', + 'trip_last_average_speed', + 'trip_last_average_electric_consumption', + 'trip_last_average_fuel_consumption', + 'trip_last_duration', + 'trip_last_length' +] + +def is_enabled(attr): + """Return true if the user has enabled the resource.""" + return attr in RESOURCES + +async def main(): + """Main method.""" + async with ClientSession(headers={'Connection': 'keep-alive'}) as session: + connection = Connection(session, VW_USERNAME, VW_PASSWORD) + if await connection.doLogin(): + if await connection.update(): + # Print overall state + pprint.pprint(connection._state) + + # Print vehicles + for vehicle in connection.vehicles: + pprint.pprint(vehicle) + + # get all instruments + instruments = set() + for vehicle in connection.vehicles: + dashboard = vehicle.dashboard(mutable=True) + + for instrument in ( + instrument + for instrument in dashboard.instruments + if instrument.component in COMPONENTS + and is_enabled(instrument.slug_attr)): + + instruments.add(instrument) + + # Output all supported instruments + for instrument in instruments: + print(f'name: {instrument.full_name}') + print(f'str_state: {instrument.str_state}') + print(f'state: {instrument.state}') + print(f'supported: {instrument.is_supported}') + print(f'attr: {instrument.attr}') + print(f'attributes: {instrument.attributes}') + +if __name__ == "__main__": + loop = asyncio.get_event_loop() + # loop.run(main()) + loop.run_until_complete(main()) +``` + +## Development +I'd strongly advise installing the git pre-commit hook using `pre-commit install`. See [pre-commit.com](https://pre-commit.com/) for details. +Some basic checks are performed before you commit the code, so code style issues +will be visible and fixable before creating the PR. Git pre-commit hooks can +always be skipped using the `--no-verify` flag to `git commit`, if there +is something preventing you from actually fixing the reported (and non-auto-fixed) issues. + +Decent test coverage for any new or changed code is also much appreciated :) + + +%package -n python3-volkswagencarnet +Summary: Communicate with Volkswagen WeConnect +Provides: python-volkswagencarnet +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-volkswagencarnet +# Volkswagen Carnet + +[](https://www.buymeacoffee.com/robinostlund) + + + + + + +[](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml) +[](https://codecov.io/gh/robinostlund/volkswagencarnet) + + + + + + +## Information + +Retrieve statistics about your Volkswagen from the Volkswagen Carnet online service + +No licence, public domain, no guarantees, feel free to use for anything. Please contribute improvements/bugfixes etc. + +## Thanks to + +- [Wez3](https://github.com/wez3) +- [Reneboer](https://github.com/reneboer) +- [Tubalainen](https://github.com/tubalainen) +- [JohNan](https://github.com/JohNan) +- [milkboy](https://github.com/milkboy) + +For supporting and helping in this project. + +## Other related repositories + +- [HomeAssistant Component](https://github.com/robinostlund/homeassistant-volkswagencarnet) a custom component for Home Assistant + +## Installation + +```sh +[venv-python3] user@localhost:~ +$ pip install volkswagencarnet +``` + +### Example + +```python +#!/usr/bin/env python3 +from volkswagencarnet.vw_connection import Connection +import pprint +import asyncio +import logging + +from aiohttp import ClientSession + +logging.basicConfig(level=logging.DEBUG) + +VW_USERNAME='test@example.com' +VW_PASSWORD='mysecretpassword' + + +COMPONENTS = { + 'sensor': 'sensor', + 'binary_sensor': 'binary_sensor', + 'lock': 'lock', + 'device_tracker': 'device_tracker', + 'switch': 'switch', + 'climate': 'climate' +} + +RESOURCES = [ + 'position', + 'distance', + 'electric_climatisation', + 'combustion_climatisation', + 'window_heater', + 'combustion_engine_heating', + 'charging', + 'adblue_level', + 'battery_level', + 'fuel_level', + 'service_inspection', + 'oil_inspection', + 'last_connected', + 'charging_time_left', + 'electric_range', + 'combustion_range', + 'combined_range', + 'charge_max_ampere', + 'climatisation_target_temperature', + 'external_power', + 'parking_light', + 'climatisation_without_external_power', + 'door_locked', + 'trunk_locked', + 'request_in_progress', + 'windows_closed', + 'sunroof_closed', + 'trip_last_average_speed', + 'trip_last_average_electric_consumption', + 'trip_last_average_fuel_consumption', + 'trip_last_duration', + 'trip_last_length' +] + +def is_enabled(attr): + """Return true if the user has enabled the resource.""" + return attr in RESOURCES + +async def main(): + """Main method.""" + async with ClientSession(headers={'Connection': 'keep-alive'}) as session: + connection = Connection(session, VW_USERNAME, VW_PASSWORD) + if await connection.doLogin(): + if await connection.update(): + # Print overall state + pprint.pprint(connection._state) + + # Print vehicles + for vehicle in connection.vehicles: + pprint.pprint(vehicle) + + # get all instruments + instruments = set() + for vehicle in connection.vehicles: + dashboard = vehicle.dashboard(mutable=True) + + for instrument in ( + instrument + for instrument in dashboard.instruments + if instrument.component in COMPONENTS + and is_enabled(instrument.slug_attr)): + + instruments.add(instrument) + + # Output all supported instruments + for instrument in instruments: + print(f'name: {instrument.full_name}') + print(f'str_state: {instrument.str_state}') + print(f'state: {instrument.state}') + print(f'supported: {instrument.is_supported}') + print(f'attr: {instrument.attr}') + print(f'attributes: {instrument.attributes}') + +if __name__ == "__main__": + loop = asyncio.get_event_loop() + # loop.run(main()) + loop.run_until_complete(main()) +``` + +## Development +I'd strongly advise installing the git pre-commit hook using `pre-commit install`. See [pre-commit.com](https://pre-commit.com/) for details. +Some basic checks are performed before you commit the code, so code style issues +will be visible and fixable before creating the PR. Git pre-commit hooks can +always be skipped using the `--no-verify` flag to `git commit`, if there +is something preventing you from actually fixing the reported (and non-auto-fixed) issues. + +Decent test coverage for any new or changed code is also much appreciated :) + + +%package help +Summary: Development documents and examples for volkswagencarnet +Provides: python3-volkswagencarnet-doc +%description help +# Volkswagen Carnet + +[](https://www.buymeacoffee.com/robinostlund) + + + + + + +[](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml) +[](https://codecov.io/gh/robinostlund/volkswagencarnet) + + + + + + +## Information + +Retrieve statistics about your Volkswagen from the Volkswagen Carnet online service + +No licence, public domain, no guarantees, feel free to use for anything. Please contribute improvements/bugfixes etc. + +## Thanks to + +- [Wez3](https://github.com/wez3) +- [Reneboer](https://github.com/reneboer) +- [Tubalainen](https://github.com/tubalainen) +- [JohNan](https://github.com/JohNan) +- [milkboy](https://github.com/milkboy) + +For supporting and helping in this project. + +## Other related repositories + +- [HomeAssistant Component](https://github.com/robinostlund/homeassistant-volkswagencarnet) a custom component for Home Assistant + +## Installation + +```sh +[venv-python3] user@localhost:~ +$ pip install volkswagencarnet +``` + +### Example + +```python +#!/usr/bin/env python3 +from volkswagencarnet.vw_connection import Connection +import pprint +import asyncio +import logging + +from aiohttp import ClientSession + +logging.basicConfig(level=logging.DEBUG) + +VW_USERNAME='test@example.com' +VW_PASSWORD='mysecretpassword' + + +COMPONENTS = { + 'sensor': 'sensor', + 'binary_sensor': 'binary_sensor', + 'lock': 'lock', + 'device_tracker': 'device_tracker', + 'switch': 'switch', + 'climate': 'climate' +} + +RESOURCES = [ + 'position', + 'distance', + 'electric_climatisation', + 'combustion_climatisation', + 'window_heater', + 'combustion_engine_heating', + 'charging', + 'adblue_level', + 'battery_level', + 'fuel_level', + 'service_inspection', + 'oil_inspection', + 'last_connected', + 'charging_time_left', + 'electric_range', + 'combustion_range', + 'combined_range', + 'charge_max_ampere', + 'climatisation_target_temperature', + 'external_power', + 'parking_light', + 'climatisation_without_external_power', + 'door_locked', + 'trunk_locked', + 'request_in_progress', + 'windows_closed', + 'sunroof_closed', + 'trip_last_average_speed', + 'trip_last_average_electric_consumption', + 'trip_last_average_fuel_consumption', + 'trip_last_duration', + 'trip_last_length' +] + +def is_enabled(attr): + """Return true if the user has enabled the resource.""" + return attr in RESOURCES + +async def main(): + """Main method.""" + async with ClientSession(headers={'Connection': 'keep-alive'}) as session: + connection = Connection(session, VW_USERNAME, VW_PASSWORD) + if await connection.doLogin(): + if await connection.update(): + # Print overall state + pprint.pprint(connection._state) + + # Print vehicles + for vehicle in connection.vehicles: + pprint.pprint(vehicle) + + # get all instruments + instruments = set() + for vehicle in connection.vehicles: + dashboard = vehicle.dashboard(mutable=True) + + for instrument in ( + instrument + for instrument in dashboard.instruments + if instrument.component in COMPONENTS + and is_enabled(instrument.slug_attr)): + + instruments.add(instrument) + + # Output all supported instruments + for instrument in instruments: + print(f'name: {instrument.full_name}') + print(f'str_state: {instrument.str_state}') + print(f'state: {instrument.state}') + print(f'supported: {instrument.is_supported}') + print(f'attr: {instrument.attr}') + print(f'attributes: {instrument.attributes}') + +if __name__ == "__main__": + loop = asyncio.get_event_loop() + # loop.run(main()) + loop.run_until_complete(main()) +``` + +## Development +I'd strongly advise installing the git pre-commit hook using `pre-commit install`. See [pre-commit.com](https://pre-commit.com/) for details. +Some basic checks are performed before you commit the code, so code style issues +will be visible and fixable before creating the PR. Git pre-commit hooks can +always be skipped using the `--no-verify` flag to `git commit`, if there +is something preventing you from actually fixing the reported (and non-auto-fixed) issues. + +Decent test coverage for any new or changed code is also much appreciated :) + + +%prep +%autosetup -n volkswagencarnet-4.4.59 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-volkswagencarnet -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 4.4.59-1 +- Package Spec generated |
