Compare commits

...

6 Commits
0.6.0 ... 0.7.0

Author SHA1 Message Date
57abb51b13 Shipping 0.7.0 2021-07-01 11:54:45 +02:00
54b7e9b5d6 Setup ne device event on georide Ha 2021-07-01 11:54:03 +02:00
24180c9345 Shipping v0.6.2 2021-05-05 22:56:38 +02:00
af0a4a37aa Bump georideapilib min version to v0.6.1 2021-05-05 22:53:52 +02:00
a83bae6d3e Shipping v0.6.1 2021-04-11 18:01:27 +02:00
c229ca4b6e Fix lock change 2021-04-11 18:00:54 +02:00
5 changed files with 107 additions and 15 deletions

View File

@@ -10,6 +10,85 @@ Official GeoRide website: https://georide.fr/
## Description ## Description
This component add some sensor for GeoRide Tracker This component add some sensor for GeoRide Tracker
### What's entity is available :
Get GeoRide position
Get GeoRide lock status
Change GeoRide lock status
Add GeoRide from configuration.yml
Add GeoRide from interface
Get stollen status
Get crashed status
Get is owner status
Get subsription status
### What's events are available:
you can filter by data.device_id == XX (XX is your tracker id)
you can display your tracker name by by data.device_name
event;
georide_position_event
georide_lock_event
georide_device_event
georide_alarm_event
you can filter with data.type == 'alarm_vibration' to filter by vibration
here is the alarm type available: (listen the georide_alarm_event)
alarm_vibration
alarm_exitZone
alarm_crash
alarm_crashParking
alarm_deviceOffline
alarm_deviceOnline
alarm_powerCut
alarm_powerUncut
alarm_batteryWarning
alarm_temperatureWarning
alarm_magnetOn
alarm_magnetOff
alarm_sonorAlarmOn
## Question:
### How to have the odometer in Km ?
Simply add a sensor like this in configuration.yaml
(Replace XX by your tracker id)
```yaml
sensor:
- platform: template # Conversion georide de m en km
sensors:
odometer_XX_km:
friendly_name: "Odometter - Km"
value_template: "{{ states.sensor.odometer_XX.state | multiply(0.001) | round(3, 'flour') }}"
unit_of_measurement: 'Km'
```
### How to use the event:
Simply made a automation like this:
```yaml
alias: '[TEST] Send notification'
description: ''
trigger:
- platform: event
event_type: georide_lock_event
condition: []
action:
- service: notify.mobile_app_oneplus_a3003
data:
message: 'The device {{ data.device_name }} have recieved a lock event'
mode: single
```
## Options ## Options

View File

@@ -290,9 +290,9 @@ class GeoRideContext:
event_data = { event_data = {
"device_id": tracker.tracker_id, "device_id": tracker.tracker_id,
"type": "on_lock", "device_name": tracker.tracker_name
} }
self._hass.bus.async_fire(f"{DOMAIN}_event", event_data) self._hass.bus.async_fire(f"{DOMAIN}_lock_event", event_data)
asyncio.run_coroutine_threadsafe( asyncio.run_coroutine_threadsafe(
coordinator.async_request_refresh(), self._hass.loop coordinator.async_request_refresh(), self._hass.loop
@@ -312,9 +312,9 @@ class GeoRideContext:
event_data = { event_data = {
"device_id": tracker.tracker_id, "device_id": tracker.tracker_id,
"type": "on_device", "device_name": tracker.tracker_name,
} }
self._hass.bus.async_fire(f"{DOMAIN}_event", event_data) self._hass.bus.async_fire(f"{DOMAIN}_device_event", event_data)
asyncio.run_coroutine_threadsafe( asyncio.run_coroutine_threadsafe(
coordinator.async_request_refresh(), self._hass.loop coordinator.async_request_refresh(), self._hass.loop
@@ -343,14 +343,27 @@ class GeoRideContext:
_LOGGER.info("Device online detected") _LOGGER.info("Device online detected")
elif data.name == 'powerCut': elif data.name == 'powerCut':
_LOGGER.info("powerCut detected") _LOGGER.info("powerCut detected")
elif data.name == 'powerUncut':
_LOGGER.info("powerUncut detected")
elif data.name == 'batteryWarning':
_LOGGER.info("batteryWarning detected")
elif data.name == 'temperatureWarning':
_LOGGER.info("temperatureWarning detected")
elif data.name == 'magnetOn':
_LOGGER.info("magnetOn detected")
elif data.name == 'magnetOff':
_LOGGER.info("magnetOff detected")
elif data.name == 'sonorAlarmOn':
_LOGGER.info("sonorAlarmOn detected")
else: else:
_LOGGER.warning("Unamanged alarm: %s", data.name) _LOGGER.warning("Unmanaged alarm: %s", data.name)
event_data = { event_data = {
"device_id": tracker.tracker_id, "device_id": tracker.tracker_id,
"type": f"alarm_{data.name}", "device_name": tracker.tracker_name,
"type": f"alarm_{data.name}"
} }
self._hass.bus.async_fire(f"{DOMAIN}_event", event_data) self._hass.bus.fire(f"{DOMAIN}_alarm_event", event_data)
asyncio.run_coroutine_threadsafe( asyncio.run_coroutine_threadsafe(
coordinator.async_request_refresh(), self._hass.loop coordinator.async_request_refresh(), self._hass.loop
).result() ).result()
@@ -372,9 +385,9 @@ class GeoRideContext:
event_data = { event_data = {
"device_id": tracker.tracker_id, "device_id": tracker.tracker_id,
"type": "position", "device_name": tracker.tracker_name
} }
self._hass.bus.async_fire(f"{DOMAIN}_event", event_data) self._hass.bus.async_fire(f"{DOMAIN}_position_event", event_data)
asyncio.run_coroutine_threadsafe( asyncio.run_coroutine_threadsafe(
coordinator.async_request_refresh(), self._hass.loop coordinator.async_request_refresh(), self._hass.loop
).result() ).result()

View File

@@ -4,10 +4,10 @@
"config_flow": true, "config_flow": true,
"documentation": "https://github.com/ptimatth/GeorideHA", "documentation": "https://github.com/ptimatth/GeorideHA",
"requirements": [ "requirements": [
"georideapilib>=0.6.0", "georideapilib>=0.6.1",
"pyjwt>=1.7.1" "pyjwt>=1.7.1"
], ],
"dependencies": [], "dependencies": [],
"codeowners": ["ptimatth"], "codeowners": ["ptimatth"],
"version": "0.6.0" "version": "0.7.0"
} }

View File

@@ -58,7 +58,7 @@ class GeoRideLockSwitchEntity(CoordinatorEntity, SwitchEntity):
success = await self._hass.async_add_executor_job(GeoRideApi.lock_tracker, success = await self._hass.async_add_executor_job(GeoRideApi.lock_tracker,
token, self._tracker_device.tracker.tracker_id) token, self._tracker_device.tracker.tracker_id)
if success: if success:
self._tracker.is_locked = True self._tracker_device.tracker.is_locked = True
async def async_turn_off(self, **kwargs): async def async_turn_off(self, **kwargs):
""" unlock the GeoRide tracker """ """ unlock the GeoRide tracker """
@@ -68,7 +68,7 @@ class GeoRideLockSwitchEntity(CoordinatorEntity, SwitchEntity):
success = await self._hass.async_add_executor_job(GeoRideApi.unlock_tracker, success = await self._hass.async_add_executor_job(GeoRideApi.unlock_tracker,
token, self._tracker_device.tracker.tracker_id) token, self._tracker_device.tracker.tracker_id)
if success: if success:
self._tracker.is_locked = False self._tracker_device.tracker.is_locked = False
async def async_toggle(self, **kwargs): async def async_toggle(self, **kwargs):
""" toggle lock the georide tracker """ """ toggle lock the georide tracker """
@@ -77,7 +77,7 @@ class GeoRideLockSwitchEntity(CoordinatorEntity, SwitchEntity):
token = await georide_context.get_token() token = await georide_context.get_token()
result = await self._hass.async_add_executor_job(GeoRideApi.toogle_lock_tracker, result = await self._hass.async_add_executor_job(GeoRideApi.toogle_lock_tracker,
token, self._tracker_device.tracker.tracker_id) token, self._tracker_device.tracker.tracker_id)
self._tracker.is_locked = result self._tracker_device.tracker.is_locked = result
@property @property
def unique_id(self): def unique_id(self):

View File

@@ -4,5 +4,5 @@
"render_readme": true, "render_readme": true,
"domains": ["devices_tracker", "sensor"], "domains": ["devices_tracker", "sensor"],
"country": ["FR"], "country": ["FR"],
"homeassistant": "2021.4.0" "homeassistant": "2021.6.0"
} }