Compare commits

...

14 Commits

Author SHA1 Message Date
Ron
985468d7a2 Update manifest.json 2023-03-03 09:52:56 +01:00
Ron
ff0ccb7e99 Update manifest.json 2023-03-03 09:52:34 +01:00
Ron
f59b41e7c4 Fixed errors for weight and stress sensors 2023-03-03 09:52:23 +01:00
Ron
0074b94723 Fixed syntax error 2023-02-03 09:14:27 +01:00
Ron
ee777314f9 Update manifest.json 2023-02-02 18:13:12 +01:00
Ron
58f5dd49db Merge pull request #62 from misa1515/patch-2
Create sk.json
2023-02-02 18:12:30 +01:00
Ron
7b66c4b7be Update manifest.json 2023-02-02 18:11:13 +01:00
Ron
1aa8cfb78f Use async_forward_entry_setups instead of async_setup_platforms 2023-02-02 18:10:58 +01:00
misa1515
a29be3127e Create sk.json
Created new translation to slovak language
2023-01-20 21:13:04 +01:00
Ron
ef91580157 Updated version 2023-01-10 09:05:17 +01:00
Ron
1c3e5a4385 Merge pull request #61 from arniebarni/main
Use local time zone for alarms
2023-01-10 08:33:02 +01:00
arniebarni
b6aebe1637 use local time zone for alarms 2023-01-09 19:47:11 +01:00
Ron
9cf15616ab Updated version 2023-01-09 13:37:22 +01:00
Ron
911ca663ab Fixed timestamp related sensors 2023-01-09 13:37:05 +01:00
5 changed files with 62 additions and 36 deletions

View File

@@ -37,7 +37,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
DATA_COORDINATOR: coordinator,
}
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True

View File

@@ -88,7 +88,7 @@ GARMIN_ENTITY_LIST = {
"Highly Active Time",
TIME_MINUTES,
"mdi:fire",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
False,
],
@@ -99,7 +99,7 @@ GARMIN_ENTITY_LIST = {
"Awake Duration",
TIME_MINUTES,
"mdi:sleep",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -107,7 +107,7 @@ GARMIN_ENTITY_LIST = {
"Sleep Duration",
TIME_MINUTES,
"mdi:sleep",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -160,13 +160,13 @@ GARMIN_ENTITY_LIST = {
],
"averageStressLevel": ["Avg Stress Level", "lvl", "mdi:flash-alert", None, SensorStateClass.TOTAL, True],
"maxStressLevel": ["Max Stress Level", "lvl", "mdi:flash-alert", None, SensorStateClass.TOTAL, True],
"stressQualifier": ["Stress Qualifier", None, "mdi:flash-alert", None, SensorStateClass.TOTAL, False],
"stressQualifier": ["Stress Qualifier", None, "mdi:flash-alert", None, None, False],
"stressDuration": ["Stress Duration", TIME_MINUTES, "mdi:flash-alert", None, SensorStateClass.TOTAL, False],
"restStressDuration": [
"Rest Stress Duration",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -174,7 +174,7 @@ GARMIN_ENTITY_LIST = {
"Activity Stress Duration",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -182,7 +182,7 @@ GARMIN_ENTITY_LIST = {
"Uncat. Stress Duration",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -190,7 +190,7 @@ GARMIN_ENTITY_LIST = {
"Total Stress Duration",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -198,7 +198,7 @@ GARMIN_ENTITY_LIST = {
"Low Stress Duration",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -206,7 +206,7 @@ GARMIN_ENTITY_LIST = {
"Medium Stress Duration",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
True,
],
@@ -222,7 +222,7 @@ GARMIN_ENTITY_LIST = {
"Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -230,7 +230,7 @@ GARMIN_ENTITY_LIST = {
"Rest Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -238,7 +238,7 @@ GARMIN_ENTITY_LIST = {
"Activity Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -246,7 +246,7 @@ GARMIN_ENTITY_LIST = {
"Uncat. Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -254,7 +254,7 @@ GARMIN_ENTITY_LIST = {
"Low Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -262,7 +262,7 @@ GARMIN_ENTITY_LIST = {
"Medium Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -270,7 +270,7 @@ GARMIN_ENTITY_LIST = {
"High Stress Percentage",
PERCENTAGE,
"mdi:flash-alert",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
False,
],
@@ -278,7 +278,7 @@ GARMIN_ENTITY_LIST = {
"Moderate Intensity",
TIME_MINUTES,
"mdi:flash-alert",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
False,
],
@@ -286,7 +286,7 @@ GARMIN_ENTITY_LIST = {
"Vigorous Intensity",
TIME_MINUTES,
"mdi:run-fast",
None,
SensorDeviceClass.DURATION,
SensorStateClass.TOTAL,
False,
],
@@ -302,7 +302,7 @@ GARMIN_ENTITY_LIST = {
"Body Battery Charged",
PERCENTAGE,
"mdi:battery-charging-100",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
True,
],
@@ -310,7 +310,7 @@ GARMIN_ENTITY_LIST = {
"Body Battery Drained",
PERCENTAGE,
"mdi:battery-alert-variant-outline",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
True,
],
@@ -318,7 +318,7 @@ GARMIN_ENTITY_LIST = {
"Body Battery Highest",
PERCENTAGE,
"mdi:battery-heart",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
True,
],
@@ -326,7 +326,7 @@ GARMIN_ENTITY_LIST = {
"Body Battery Lowest",
PERCENTAGE,
"mdi:battery-heart-outline",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
True,
],
@@ -334,7 +334,7 @@ GARMIN_ENTITY_LIST = {
"Body Battery Most Recent",
PERCENTAGE,
"mdi:battery-positive",
SensorDeviceClass.BATTERY,
None,
SensorStateClass.TOTAL,
True,
],
@@ -346,7 +346,7 @@ GARMIN_ENTITY_LIST = {
None,
"mdi:diabetes",
SensorDeviceClass.TIMESTAMP,
SensorStateClass.TOTAL,
None,
False,
],
"averageMonitoringEnvironmentAltitude": [
@@ -389,14 +389,14 @@ GARMIN_ENTITY_LIST = {
None,
False,
],
"weight": ["Weight", MASS_KILOGRAMS, "mdi:weight-kilogram", SensorDeviceClass.WEIGHT, SensorStateClass.TOTAL, False],
"weight": ["Weight", MASS_KILOGRAMS, "mdi:weight-kilogram", SensorDeviceClass.WEIGHT, SensorStateClass.MEASUREMENT, False],
"bmi": ["BMI", "bmi", "mdi:food", None, SensorStateClass.TOTAL, False],
"bodyFat": ["Body Fat", PERCENTAGE, "mdi:food", SensorDeviceClass.MOISTURE, SensorStateClass.TOTAL, False],
"bodyWater": ["Body Water", PERCENTAGE, "mdi:water-percent", SensorDeviceClass.MOISTURE, SensorStateClass.TOTAL, False],
"boneMass": ["Bone Mass", MASS_KILOGRAMS, "mdi:bone", SensorDeviceClass.WEIGHT, SensorStateClass.TOTAL, False],
"muscleMass": ["Muscle Mass", MASS_KILOGRAMS, "mdi:dumbbell", SensorDeviceClass.WEIGHT, SensorStateClass.TOTAL, False],
"bodyFat": ["Body Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.TOTAL, False],
"bodyWater": ["Body Water", PERCENTAGE, "mdi:water-percent", None, SensorStateClass.TOTAL, False],
"boneMass": ["Bone Mass", MASS_KILOGRAMS, "mdi:bone", SensorDeviceClass.WEIGHT, SensorStateClass.MEASUREMENT, False],
"muscleMass": ["Muscle Mass", MASS_KILOGRAMS, "mdi:dumbbell", SensorDeviceClass.WEIGHT, SensorStateClass.MEASUREMENT, False],
"physiqueRating": ["Physique Rating", None, "mdi:numeric", None, SensorStateClass.TOTAL, False],
"visceralFat": ["Visceral Fat", PERCENTAGE, "mdi:food", SensorDeviceClass.MOISTURE, SensorStateClass.TOTAL, False],
"visceralFat": ["Visceral Fat", PERCENTAGE, "mdi:food", None, SensorStateClass.TOTAL, False],
"metabolicAge": ["Metabolic Age", TIME_YEARS, "mdi:calendar-heart", None, SensorStateClass.TOTAL, False],
"nextAlarm": ["Next Alarm Time", None, "mdi:alarm", SensorDeviceClass.TIMESTAMP, SensorStateClass.TOTAL, True],
"nextAlarm": ["Next Alarm Time", None, "mdi:alarm", SensorDeviceClass.TIMESTAMP, None, True],
}

View File

@@ -7,5 +7,5 @@
"codeowners": ["@cyberjunky"],
"config_flow": true,
"iot_class": "cloud_polling",
"version": "0.2.7"
"version": "0.2.13"
}

View File

@@ -4,6 +4,7 @@ from __future__ import annotations
import logging
import datetime
import pytz
from tzlocal import get_localzone
from homeassistant.components.sensor import (
SensorEntity,
@@ -118,7 +119,8 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
)
if active_alarms:
date_time_obj = datetime.datetime.strptime(active_alarms[0], "%Y-%m-%dT%H:%M:%S")
timezone = pytz.timezone('UTC')
tz = get_localzone()
timezone = pytz.timezone(tz.zone)
timezone_date_time_obj = timezone.localize(date_time_obj)
return timezone_date_time_obj
else:
@@ -128,7 +130,8 @@ class GarminConnectSensor(CoordinatorEntity, SensorEntity):
if self._device_class == SensorDeviceClass.TIMESTAMP:
date_time_obj = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%f")
timezone = pytz.timezone('UTC')
tz = get_localzone()
timezone = pytz.timezone(tz.zone)
timezone_date_time_obj = timezone.localize(date_time_obj)
return timezone_date_time_obj

View File

@@ -0,0 +1,23 @@
{
"config": {
"abort": {
"already_configured": "Účet je už nakonfigurovaný"
},
"error": {
"cannot_connect": "Nepodarilo sa pripojiť",
"invalid_auth": "Neplatné overenie",
"too_many_requests": "Príliš veľa žiadostí, skúste to neskôr.",
"unknown": "Neočakávaná chyba"
},
"step": {
"user": {
"data": {
"password": "Heslo",
"username": "Užívateľské meno"
},
"description": "Zadajte svoje poverenia.",
"title": "Garmin Connect"
}
}
}
}