Skip to content

Commit

Permalink
feat: support presence sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
rxwen committed Nov 6, 2023
1 parent 505d4c5 commit 4964709
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ There is support for the following device type within Home Assistant:
- Temperature Sensor
- Humidity Sensor
- Illuminance Sensor
- Presence Sensor
- Air Conditioner

## Manul Installation
Expand Down
1 change: 1 addition & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- 温度传感器
- 湿度传感器
- 照度传感器
- 存在传感器
- 空调

## 手动安装方法
Expand Down
2 changes: 1 addition & 1 deletion custom_components/terncy/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TerncyBinarySensorDescription(
PLATFORM: Platform = Platform.BINARY_SENSOR
has_entity_name: bool = True
value_attr: str = ""
value_map: dict[int, bool] = field(default_factory=lambda: {1: True, 0: False})
value_map: dict[int, bool] = field(default_factory=lambda: {4: True, 3: True, 2: True, 1: True, 0: False})


async def async_setup_entry(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/terncy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/rxwen/homeassistant-terncy-component/issues",
"requirements": ["terncy==0.3.5","websockets>=10.3","zeroconf>=0.28.8"],
"version": "1.0.30",
"version": "1.0.32",
"zeroconf": [
{"type":"_websocket._tcp.local.","name":"box-*"}
]
Expand Down
8 changes: 8 additions & 0 deletions custom_components/terncy/profiles/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
PROFILE_SMART_DIAL,
PROFILE_SWITCH,
PROFILE_YAN_BUTTON,
PROFILE_PRESENCE_SENSOR,
TerncyEntityDescription,
)
from ..cover import TerncyCoverDescription
Expand Down Expand Up @@ -270,6 +271,13 @@
supported_color_modes={ColorMode.COLOR_TEMP, ColorMode.HS},
),
],
PROFILE_PRESENCE_SENSOR: [
TerncyBinarySensorDescription(
key="presenceStatus",
device_class=BinarySensorDeviceClass.PRESENCE,
value_attr="presenceStatus",
),
],
}

if HAS_EVENT_PLATFORM:
Expand Down

0 comments on commit 4964709

Please sign in to comment.