Title: add property_action? · Issue #74 · WebThingsIO/webthing-python · GitHub
Open Graph Title: add property_action? · Issue #74 · WebThingsIO/webthing-python
X Title: add property_action? · Issue #74 · WebThingsIO/webthing-python
Description: In some scenarios, such as switching lights on and off, we need to do something extra to synchronize the state with the device after updating the properties, but webthing-python doesn't seem to implement this feature, I add this in aiowe...
Open Graph Description: In some scenarios, such as switching lights on and off, we need to do something extra to synchronize the state with the device after updating the properties, but webthing-python doesn't seem to imp...
X Description: In some scenarios, such as switching lights on and off, we need to do something extra to synchronize the state with the device after updating the properties, but webthing-python doesn't seem to...
Opengraph URL: https://github.com/WebThingsIO/webthing-python/issues/74
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"add property_action?","articleBody":" In some scenarios, such as switching lights on and off, we need to do something extra to synchronize the state with the device after updating the properties, but webthing-python doesn't seem to implement this feature, I add this in [aiowebthing](https://github.com/hidaris/aiowebthing/blob/master/webthing/thing.py#L424), [property](https://github.com/hidaris/aiowebthing/blob/master/webthing/property.py#L36):\r\n```python\r\nasync def property_action(self, property_):\r\n \"\"\"\r\n Additional action when a property change.\r\n property_ -- the property that changed\r\n \"\"\"\r\n pass\r\n```\r\n[usage example](https://github.com/hidaris/webthing-zigbee/blob/master/main.py#L26):\r\n```python\r\nclass Z2mThing(Thing):\r\n async def property_action(self, property_):\r\n if property_.name == \"state\":\r\n value = \"ON\" if await property_.get_value() else \"OFF\"\r\n else:\r\n value = await property_.get_value()\r\n await mqtt.publish(f\"zigbee2mqtt/{self.id}/set\", {property_.name: value})\r\n```","author":{"url":"https://github.com/hidaris","@type":"Person","name":"hidaris"},"datePublished":"2020-06-05T07:42:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/74/webthing-python/issues/74"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:033e4afc-15cb-1fc9-21ea-60ec98edfd52 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8852:DEAE4:D51244:11016AA:69908D74 |
| html-safe-nonce | e80575394d44287fc9f38c882e115b8ae2b2744d7ff144816508a7859bb4d501 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODUyOkRFQUU0OkQ1MTI0NDoxMTAxNkFBOjY5OTA4RDc0IiwidmlzaXRvcl9pZCI6IjM0NDI3Njg4Njc2NzUzNzcwMTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a21ffd1c386a14a1abf40e5f451d239c1ae75954d80e83497c7cec5df425900d |
| hovercard-subject-tag | issue:631383101 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/WebThingsIO/webthing-python/74/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7185ddd90ed61a778f4b43520cef4fdbf8da66868a6dbe389394b096c08494eb/WebThingsIO/webthing-python/issues/74 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7185ddd90ed61a778f4b43520cef4fdbf8da66868a6dbe389394b096c08494eb/WebThingsIO/webthing-python/issues/74 |
| og:image:alt | In some scenarios, such as switching lights on and off, we need to do something extra to synchronize the state with the device after updating the properties, but webthing-python doesn't seem to imp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hidaris |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/WebThingsIO/webthing-python git https://github.com/WebThingsIO/webthing-python.git |
| octolytics-dimension-user_id | 20707259 |
| octolytics-dimension-user_login | WebThingsIO |
| octolytics-dimension-repository_id | 124557300 |
| octolytics-dimension-repository_nwo | WebThingsIO/webthing-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 124557300 |
| octolytics-dimension-repository_network_root_nwo | WebThingsIO/webthing-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width