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

Output Home.app refresh event #392

Open
MyOzCam opened this issue Apr 19, 2021 · 12 comments · Fixed by #444
Open

Output Home.app refresh event #392

MyOzCam opened this issue Apr 19, 2021 · 12 comments · Fixed by #444
Assignees
Labels
enhancement 👍 New feature or request testing Available in dev or experimental v2.0

Comments

@MyOzCam
Copy link

MyOzCam commented Apr 19, 2021

Can we make a new output to fire whenever a HomeKit controller request the current value of the characteristic?

It could be necessary when the HomeKit node is used to control a TV which is based on webService API. Currently I am triggering a query to the TV periodically (say 1 min) to update the latest status of TV to Homekit node. So, currently status displaying on home.app may not be real time. If we can have a 'get' event output, we can fire an trigger of query to update the latest status in almost realtime.

@Shaquu
Copy link
Member

Shaquu commented Apr 19, 2021

So basically you would like to hook into nrchkb/HapNodeJS internals? I don't see a problem, actually feature which will allow that is planned (plugin system).

@crxporter
Copy link
Member

I think the get event is called when the home app opens up and "refreshes" the item state? If I understand, basically you want to poll another api in nodered whenever someone opens up the home app, right?

@MyOzCam
Copy link
Author

MyOzCam commented Apr 20, 2021

Yes. I believe “get” event is there for this purpose.

@Shaquu
Copy link
Member

Shaquu commented Jul 16, 2021

image
Second output will contain msg.hap.event

@Shaquu Shaquu added this to To do in NRCHKB 1.4.0 via automation Jul 16, 2021
@Shaquu Shaquu added the enhancement 👍 New feature or request label Jul 16, 2021
@Shaquu Shaquu self-assigned this Jul 16, 2021
@Shaquu Shaquu moved this from To do to In progress in NRCHKB 1.4.0 Jul 16, 2021
@Shaquu
Copy link
Member

Shaquu commented Jul 16, 2021

image
image

@Shaquu Shaquu changed the title New output as 'get' event Output Home.app refresh event Jul 16, 2021
Shaquu added a commit that referenced this issue Jul 16, 2021
@Shaquu Shaquu moved this from In progress to Review in progress in NRCHKB 1.4.0 Jul 16, 2021
@Shaquu Shaquu removed this from Review in progress in NRCHKB 1.4.0 Jul 23, 2021
@Shaquu Shaquu added this to To do in NRCHKB 2.0.0 via automation Jul 23, 2021
@Shaquu
Copy link
Member

Shaquu commented Jul 23, 2021

Together with NRCHKB 2.0.0 onSet and onChange will be merged into unified output called events
It will output data for all event types defined below:

  • set
  • change
  • subscribe
  • unsubscribe
  • characteristic-warning

Until then node service2 might be released as experimental feature.

Node output will look like:

type HAPServiceNodeEvent = {name: CharacteristicEventTypes, context?: any}

type HAPServiceNodeOutput = {
    payload: { [key: string]: any }
    hap: {
        oldValue?: any
        newValue?: any
        context?: any
        event: HAPServiceNodeEvent
        session?: {
            sessionID?: SessionIdentifier,
            username?: HAPUsername,
            remoteAddress?: string,
            localAddress?: string,
            httpPort?: number,
        }
    }
    name?: string
    topic: string
}

@crxporter
Copy link
Member

Anything with ? is optional and anything without will always be defined? It's looking good!

All of these messages are from one single output, correct?

@Shaquu
Copy link
Member

Shaquu commented Jul 23, 2021

Indeed,? means that undefined is allowed so value can be empty :)

@crxporter
Copy link
Member

crxporter commented Jul 23, 2021

So a switch node watching for

msg.hap.event == "onSet"

we would expect to see the same output as current first output?

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
@crxporter
Copy link
Member

This is available now in "experimental" using Service 2 node!

@Shaquu can you provide or point us to some quick nodes on how to enable experimental?

@crxporter crxporter added the testing Available in dev or experimental label Oct 4, 2021
@TheNON75 TheNON75 added the v2.0 label Oct 4, 2021
@Shaquu Shaquu linked a pull request Oct 6, 2021 that will close this issue
NRCHKB 2.0.0 automation moved this from To do to Done Oct 11, 2021
@Shaquu Shaquu reopened this Oct 11, 2021
NRCHKB 2.0.0 automation moved this from Done to In progress Oct 11, 2021
@Shaquu
Copy link
Member

Shaquu commented Oct 11, 2021

@crxporter here it is described how to enable experimental mode
https://nrchkb.github.io/wiki/discover-more/experimental/#getting-started

@ralphwetzel
Copy link

What's the schedule to move this into the standard ... perhaps (initially) as an alternative node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 👍 New feature or request testing Available in dev or experimental v2.0
Projects
NRCHKB 2.0.0
In progress
Development

Successfully merging a pull request may close this issue.

5 participants