mirror of
				https://github.com/house-of-abbey/GarminHomeAssistant.git
				synced 2025-11-04 00:48:14 +00:00 
			
		
		
		
	Set icons for sent sensor values
This commit is contained in:
		@@ -130,32 +130,38 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                "state"     => System.getSystemStats().battery,
 | 
					                "state"     => System.getSystemStats().battery,
 | 
				
			||||||
                "type"      => "sensor",
 | 
					                "type"      => "sensor",
 | 
				
			||||||
                "unique_id" => "battery_level"
 | 
					                "unique_id" => "battery_level",
 | 
				
			||||||
 | 
					                "icon"      => "mdi:battery"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "state"     => System.getSystemStats().charging,
 | 
					                "state"     => System.getSystemStats().charging,
 | 
				
			||||||
                "type"      => "binary_sensor",
 | 
					                "type"      => "binary_sensor",
 | 
				
			||||||
                "unique_id" => "battery_is_charging"
 | 
					                "unique_id" => "battery_is_charging",
 | 
				
			||||||
 | 
					                "icon"      => System.getSystemStats().charging ? "mdi:battery-plus" : "mdi:battery-minus"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "state"     => activityInfo.steps == null ? "unknown" : activityInfo.steps,
 | 
					                "state"     => activityInfo.steps == null ? "unknown" : activityInfo.steps,
 | 
				
			||||||
                "type"      => "sensor",
 | 
					                "type"      => "sensor",
 | 
				
			||||||
                "unique_id" => "steps_today"
 | 
					                "unique_id" => "steps_today",
 | 
				
			||||||
 | 
					                "icon"      => "mdi:walk"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "state"     => heartRate == null ? "unknown" : heartRate,
 | 
					                "state"     => heartRate == null ? "unknown" : heartRate,
 | 
				
			||||||
                "type"      => "sensor",
 | 
					                "type"      => "sensor",
 | 
				
			||||||
                "unique_id" => "heart_rate"
 | 
					                "unique_id" => "heart_rate",
 | 
				
			||||||
 | 
					                "icon"      => "mdi:heart-pulse"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "state"     => activityInfo.floorsClimbed == null ? "unknown" : activityInfo.floorsClimbed,
 | 
					                "state"     => activityInfo.floorsClimbed == null ? "unknown" : activityInfo.floorsClimbed,
 | 
				
			||||||
                "type"      => "sensor",
 | 
					                "type"      => "sensor",
 | 
				
			||||||
                "unique_id" => "floors_climbed_today",
 | 
					                "unique_id" => "floors_climbed_today",
 | 
				
			||||||
 | 
					                "icon"      => "mdi:stairs-up"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "state"     => activityInfo.floorsDescended == null ? "unknown" : activityInfo.floorsDescended,
 | 
					                "state"     => activityInfo.floorsDescended == null ? "unknown" : activityInfo.floorsDescended,
 | 
				
			||||||
                "type"      => "sensor",
 | 
					                "type"      => "sensor",
 | 
				
			||||||
                "unique_id" => "floors_descended_today",
 | 
					                "unique_id" => "floors_descended_today",
 | 
				
			||||||
 | 
					                "icon"      => "mdi:stairs-down"
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -164,6 +170,7 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
 | 
				
			|||||||
                "state"     => activityInfo.respirationRate == null ? "unknown" : activityInfo.respirationRate,
 | 
					                "state"     => activityInfo.respirationRate == null ? "unknown" : activityInfo.respirationRate,
 | 
				
			||||||
                "type"      => "sensor",
 | 
					                "type"      => "sensor",
 | 
				
			||||||
                "unique_id" => "respiration_rate",
 | 
					                "unique_id" => "respiration_rate",
 | 
				
			||||||
 | 
					                "icon"      => "mdi:lungs"
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,6 +217,7 @@ class WebhookManager {
 | 
				
			|||||||
                "state"               => System.getSystemStats().battery,
 | 
					                "state"               => System.getSystemStats().battery,
 | 
				
			||||||
                "type"                => "sensor",
 | 
					                "type"                => "sensor",
 | 
				
			||||||
                "unique_id"           => "battery_level",
 | 
					                "unique_id"           => "battery_level",
 | 
				
			||||||
 | 
					                "icon"                => "mdi:battery",
 | 
				
			||||||
                "unit_of_measurement" => "%",
 | 
					                "unit_of_measurement" => "%",
 | 
				
			||||||
                "state_class"         => "measurement",
 | 
					                "state_class"         => "measurement",
 | 
				
			||||||
                "entity_category"     => "diagnostic",
 | 
					                "entity_category"     => "diagnostic",
 | 
				
			||||||
@@ -228,6 +229,7 @@ class WebhookManager {
 | 
				
			|||||||
                "state"           => System.getSystemStats().charging,
 | 
					                "state"           => System.getSystemStats().charging,
 | 
				
			||||||
                "type"            => "binary_sensor",
 | 
					                "type"            => "binary_sensor",
 | 
				
			||||||
                "unique_id"       => "battery_is_charging",
 | 
					                "unique_id"       => "battery_is_charging",
 | 
				
			||||||
 | 
					                "icon"            => System.getSystemStats().charging ? "mdi:battery-plus" : "mdi:battery-minus",
 | 
				
			||||||
                "entity_category" => "diagnostic",
 | 
					                "entity_category" => "diagnostic",
 | 
				
			||||||
                "disabled"        => !Settings.isSensorsLevelEnabled()
 | 
					                "disabled"        => !Settings.isSensorsLevelEnabled()
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
@@ -236,7 +238,7 @@ class WebhookManager {
 | 
				
			|||||||
                "state"       => activityInfo.steps == null ? "unknown" : activityInfo.steps,
 | 
					                "state"       => activityInfo.steps == null ? "unknown" : activityInfo.steps,
 | 
				
			||||||
                "type"        => "sensor",
 | 
					                "type"        => "sensor",
 | 
				
			||||||
                "unique_id"   => "steps_today",
 | 
					                "unique_id"   => "steps_today",
 | 
				
			||||||
                "icon"        => "mdi:shoe-print",
 | 
					                "icon"        => "mdi:walk",
 | 
				
			||||||
                "state_class" => "total",
 | 
					                "state_class" => "total",
 | 
				
			||||||
                "disabled"    => !Settings.isSensorsLevelEnabled()
 | 
					                "disabled"    => !Settings.isSensorsLevelEnabled()
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user