Skip to content
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

Status node to fetch Serialized Service #210

Closed
lsteelandt opened this issue Feb 20, 2020 · 15 comments · Fixed by #418
Closed

Status node to fetch Serialized Service #210

lsteelandt opened this issue Feb 20, 2020 · 15 comments · Fixed by #418
Assignees
Labels
enhancement 👍 New feature or request

Comments

@lsteelandt
Copy link

Related problem
For lightbulb, it is impossible to know the Homekit stored state when you switch on a light.
On Home app, when you click on a Lightbulb button, you see it highlighted with a % representing the last brightness of lightbulb. This value is not outputted to let order the node driving the associated light (for exemple an Openhab node).
For exemple when you switch On a light ( {On:true} ) received, it is difficult to send the right command to have a prefect synchronization on the displayed item's state in Home App and the reality. That's is because {On:true} doesn't give which values of H,S,B should be applied.

Whish
Can the output msg object, hold a property with the right state store in HomeKit ?
example for Lightbulb : {"On":true, "Brigthness":bbb, "Saturation":sss, "Hue":hhh}

Or in other case an msg.lastState={"Brigthness":bbb, "Saturation":sss, "Hue":hhh}

@lsteelandt lsteelandt added the enhancement 👍 New feature or request label Feb 20, 2020
@Shaquu
Copy link
Member

Shaquu commented Feb 23, 2020

Thanks for posting a feature request!

I am not sure if we can add it.

  1. I believe this feature can be done by using node-red native flows. @crxporter might look at this?
  2. Adding this could make endless loop (and would required more work in node-red to protect from it).

@radokristof
Copy link
Contributor

If you use openHAB (or any other unified platform - and just using Node-RED as an "extension"), you should store the states in openHAB I think (it does that automatically).
That way you don't need anything else in Node-RED and also if you send a command from another platform (like openHAB or anything which is connected to openHAB), your state will be in sync every time...

@crxporter
Copy link
Member

I believe this feature can be done by using node-red native flows. @crxporter might look at this?

Yes! I have many function nodes that hold brightness, hue, saturation, and other values in a context variable. I believe there are examples in the wiki page, later today I’ll take a look at the original comment here and provide some guidance.

@lsteelandt - can you share your current flow? Especially what device are you connecting to and which other nodes do you use?

@lsteelandt
Copy link
Author

@crxporter I will post it in a short time.
Thank you

@lsteelandt
Copy link
Author

@radokristof thanks for you reply.
Unfortunatly in some case you can have a bad synchro between openhab and nodered. Particularly in case of reboot.

@crxporter
Copy link
Member

For a preview, my current example of a well functioning rgb light is here. This example is controlled over mqtt (input and output) and has been working great for several months.

I’ll be happy to help you adapt it to whatever system your lights are using!

@radokristof
Copy link
Contributor

@lsteelandt you can use retain in MQTT to always have the latest available state.
If you don't want to use that, I just wait for openhab to come online and I restart automatically from a rule Node-RED (that also eliminates the problem where before if openHAB was not online the node stuck in a state where it won't tried to reconnect again).
Anyway I think most of us don't restart their system that much.
My server is running now for more than 120 days and also with weeks of uptime in terms of openHAB.

@Shaquu Shaquu changed the title [FEATURE] get HomeKit node status on output. For lightbulb and maybe more items Get HomeKit node status on output. Mar 1, 2020
@Shaquu Shaquu added side topic How to use this and workarounds and removed enhancement 👍 New feature or request labels Mar 1, 2020
@crxporter
Copy link
Member

@lsteelandt I'm trying to clean up some older issues, if you're all set then let us know to close this one. Otherwise please let us know what progress you've made and if you'd like suggestions how to move forward.

@lsteelandt
Copy link
Author

Hi, sorry for the long delay without news. I decided to manage the problem by using the state memorized by openhab item as @radokristof suggest. So this enhancement demand can be closed.

@Shaquu Shaquu reopened this Apr 18, 2020
@Shaquu
Copy link
Member

Shaquu commented Apr 18, 2020

I think I would like to have it anyway. Some new node with access to all services read only states.

@crxporter
Copy link
Member

This is for persistence within the NRCHKB plugin, correct?

@Shaquu
Copy link
Member

Shaquu commented Jun 30, 2020

I think also for pulling whole Service status at once whenever you want to.

@crxporter
Copy link
Member

It would be useful for HSV bulbs, brightness bulbs, and other items where individual data is updated and currently must be stored in nodered context stores.

@Shaquu Shaquu added this to To do in NRCHKB 1.6.0 via automation Mar 25, 2021
@Shaquu Shaquu removed this from To do in NRCHKB 1.6.0 Jul 16, 2021
@Shaquu Shaquu added this to To do in NRCHKB 1.4.0 via automation Jul 16, 2021
@Shaquu Shaquu moved this from To do to In progress in NRCHKB 1.4.0 Jul 16, 2021
@Shaquu Shaquu added enhancement 👍 New feature or request and removed side topic How to use this and workarounds labels Jul 16, 2021
@Shaquu Shaquu self-assigned this Jul 16, 2021
@Shaquu Shaquu moved this from In progress to Review in progress in NRCHKB 1.4.0 Jul 16, 2021
@Shaquu
Copy link
Member

Shaquu commented Jul 16, 2021

"Final" look and feel
image
image
image

@Shaquu Shaquu changed the title Get HomeKit node status on output. Get node to fetch Serialized Service Jul 16, 2021
Shaquu added a commit that referenced this issue Jul 18, 2021
 - no longer send empty object to first output for events
 - attached current value to events (msg.payload.key=value)
@Shaquu Shaquu linked a pull request Aug 5, 2021 that will close this issue
@crxporter crxporter changed the title Get node to fetch Serialized Service Status node to fetch Serialized Service Sep 30, 2021
@crxporter
Copy link
Member

crxporter commented Sep 30, 2021

Note: this is now called "Status" node, and works great in version 1.4 and higher.

Closing as completed in 1.4 - please re open if any issue persists on this topic.

@crxporter crxporter moved this from Review in progress to Reviewer approved in NRCHKB 1.4.0 Sep 30, 2021
@crxporter crxporter moved this from Reviewer approved to Done in NRCHKB 1.4.0 Oct 1, 2021
Shaquu added a commit that referenced this issue Oct 4, 2021
### Fixed

- Fixed customCharacteristics incorrect refresh in UI
- Implemented static accessoryUUIDs for subflows Enables the use of nrchkb nodes in subflows with backwards
  compatibility #393 - thanks @kevinkub
- Fixed Custom MDNS Configuration not showing in UI for Standalone Accessory
- Stop components from clearing other component's node.status call
- Add missing advertiser selector in UI for Standalone Accessory
- Not naming the host node causes a crash #424
- Do not output oldValue for onSet as it does not have access to old value

### Added

- Notice during app launch: Node.js 10 will be deprecated in Node-RED 2.0.0
- Event output in Service 2 which is available in NRCHKB_EXPERIMENTAL #392 #437
- Status node to fetch Serialized Service #210
- Support for environment variables in characteristic properties #217

### Changed

- Updated hap-nodejs to 0.9.5 (added new iOS 15 Services and Characteristics)
- Updated dependencies to latest versions
- Changed `BatteryService` to `Battery` in demo examples as `BatteryService` is deprecated #381 - thanks @crxporter
- Readme rework - thanks @crxporter
- More descriptive error when incorrect Characteristic has been used in msg.payload
- Add msg.hap.allChars to service nodes #438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 👍 New feature or request
Projects
No open projects
NRCHKB 1.4.0
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants