Skip to content

Commit d75e549

Browse files
authored
Add health concern entities to SmartThings (home-assistant#157773)
1 parent 2dd58db commit d75e549

File tree

3 files changed

+471
-0
lines changed

3 files changed

+471
-0
lines changed

homeassistant/components/smartthings/sensor.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@
125125
"Rinse": "rinse",
126126
}
127127

128+
HEALTH_CONCERN = {
129+
"good": "good",
130+
"moderate": "moderate",
131+
"slightlyUnhealthy": "slightly_unhealthy",
132+
"unhealthy": "unhealthy",
133+
"veryUnhealthy": "very_unhealthy",
134+
"hazardous": "hazardous",
135+
}
136+
128137
WASHER_OPTIONS = ["pause", "run", "stop"]
129138

130139

@@ -426,6 +435,17 @@ class SmartThingsSensorEntityDescription(SensorEntityDescription):
426435
)
427436
],
428437
},
438+
Capability.DUST_HEALTH_CONCERN: {
439+
Attribute.DUST_HEALTH_CONCERN: [
440+
SmartThingsSensorEntityDescription(
441+
key=Attribute.DUST_HEALTH_CONCERN,
442+
translation_key="pm10_health_concern",
443+
device_class=SensorDeviceClass.ENUM,
444+
options=list(HEALTH_CONCERN.values()),
445+
value_fn=HEALTH_CONCERN.get,
446+
)
447+
]
448+
},
429449
Capability.DUST_SENSOR: {
430450
Attribute.DUST_LEVEL: [
431451
SmartThingsSensorEntityDescription(
@@ -476,6 +496,17 @@ class SmartThingsSensorEntityDescription(SensorEntityDescription):
476496
)
477497
]
478498
},
499+
Capability.FINE_DUST_HEALTH_CONCERN: {
500+
Attribute.FINE_DUST_HEALTH_CONCERN: [
501+
SmartThingsSensorEntityDescription(
502+
key=Attribute.FINE_DUST_HEALTH_CONCERN,
503+
translation_key="pm25_health_concern",
504+
device_class=SensorDeviceClass.ENUM,
505+
options=list(HEALTH_CONCERN.values()),
506+
value_fn=HEALTH_CONCERN.get,
507+
)
508+
]
509+
},
479510
Capability.FINE_DUST_SENSOR: {
480511
Attribute.FINE_DUST_LEVEL: [
481512
SmartThingsSensorEntityDescription(
@@ -1018,6 +1049,17 @@ class SmartThingsSensorEntityDescription(SensorEntityDescription):
10181049
)
10191050
]
10201051
},
1052+
Capability.VERY_FINE_DUST_HEALTH_CONCERN: {
1053+
Attribute.VERY_FINE_DUST_HEALTH_CONCERN: [
1054+
SmartThingsSensorEntityDescription(
1055+
key=Attribute.VERY_FINE_DUST_HEALTH_CONCERN,
1056+
translation_key="pm1_health_concern",
1057+
device_class=SensorDeviceClass.ENUM,
1058+
options=list(HEALTH_CONCERN.values()),
1059+
value_fn=HEALTH_CONCERN.get,
1060+
)
1061+
]
1062+
},
10211063
Capability.VERY_FINE_DUST_SENSOR: {
10221064
Attribute.VERY_FINE_DUST_LEVEL: [
10231065
SmartThingsSensorEntityDescription(

homeassistant/components/smartthings/strings.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,39 @@
532532
"oven_setpoint": {
533533
"name": "Setpoint"
534534
},
535+
"pm10_health_concern": {
536+
"name": "PM10 health concern",
537+
"state": {
538+
"good": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::good%]",
539+
"hazardous": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::hazardous%]",
540+
"moderate": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::moderate%]",
541+
"slightly_unhealthy": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::slightly_unhealthy%]",
542+
"unhealthy": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::unhealthy%]",
543+
"very_unhealthy": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::very_unhealthy%]"
544+
}
545+
},
546+
"pm1_health_concern": {
547+
"name": "PM1 health concern",
548+
"state": {
549+
"good": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::good%]",
550+
"hazardous": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::hazardous%]",
551+
"moderate": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::moderate%]",
552+
"slightly_unhealthy": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::slightly_unhealthy%]",
553+
"unhealthy": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::unhealthy%]",
554+
"very_unhealthy": "[%key:component::smartthings::entity::sensor::pm25_health_concern::state::very_unhealthy%]"
555+
}
556+
},
557+
"pm25_health_concern": {
558+
"name": "PM2.5 health concern",
559+
"state": {
560+
"good": "Good",
561+
"hazardous": "Hazardous",
562+
"moderate": "Moderate",
563+
"slightly_unhealthy": "Slightly unhealthy",
564+
"unhealthy": "Unhealthy",
565+
"very_unhealthy": "Very unhealthy"
566+
}
567+
},
535568
"power_energy": {
536569
"name": "Power energy"
537570
},

0 commit comments

Comments
 (0)