-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: represent terncy scene as a homeassistant swtich #25
base: main
Are you sure you want to change the base?
Conversation
cc @rxwen PTAL |
@@ -367,6 +370,11 @@ async def update_or_create_entity_inner(svc, tern, model, version, available): | |||
device = TerncyTemperatureSensor(tern, devid + DEVID_EXT_TEMP, name + "-T", model, version, features) | |||
device.is_available = available | |||
await add_entity_to_platform(tern, devid + DEVID_EXT_TEMP, device, attrs, PLATFORM_SENSOR) | |||
elif model == "TERNCY-SCENE": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to define a const for "TERNCY-SCENE"
@@ -367,6 +370,11 @@ async def update_or_create_entity_inner(svc, tern, model, version, available): | |||
device = TerncyTemperatureSensor(tern, devid + DEVID_EXT_TEMP, name + "-T", model, version, features) | |||
device.is_available = available | |||
await add_entity_to_platform(tern, devid + DEVID_EXT_TEMP, device, attrs, PLATFORM_SENSOR) | |||
elif model == "TERNCY-SCENE": | |||
device = TerncyScene(tern, devid, name, model, version, features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to forge a new devid based on the id of the returned scene, and the hub's id.
Because if user pair several different hubs, each of them may return the same scene id. If we use the scene id directly, there might be ambiguation.
For instance, devid = devid + "@" + tern.dev_id
Terncy app is more powerful to define actions and combinations than home assistant in some use cases since the app is optimized to controlling Terncy devices. With this feature, I can create a scene to do complex actions and port it in homeassistant. I tested locally and it works smoothly.
This PR also fixes a bug introduced by 9917275:
close #24