-
-
Notifications
You must be signed in to change notification settings - Fork 424
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
Add numericState and unit to StateDTO #4123
Conversation
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
What if it's an integer? Will this still return a float? If so could you make it an integer? |
There seems to be no distinction in json
Where is this used? |
This is purely for the MainUI SSE. |
My concern is not the json schema description but rather the returned value.
Is this different from the sse subscription
It's still on my never ending todo list to switch from SSE to websockets. |
decimalstate is never really just an integer. It is stored as BigDecimal. I tested this with a Battery level, and I got
I'm not sure what HabApp uses. This is alongside the existing @ghys and @florian-h05 understand this better than I.
I've seen somewhere that MainUI is also going to switch to websockets, eventually |
HABApp subscribes to This is the event how I get it at the moment {
"topic": "openhab/items/Length_event_test/stateupdated",
"payload": {
"type": "Quantity",
"value": "222 m"
},
"type": "ItemStateUpdatedEvent"
} As you can see currently an integer is returned ( Now that I look at the events the names are different ( It would be very helpful nonetheless if it would be like this so I'd love to see a PR that changes these events, too. {
"topic": "openhab/items/Length_event_test/stateupdated",
"payload": {
"type": "Quantity",
"value": "222 m"
"numericValue": "222",
"unit": "m",
},
"type": "ItemStateUpdatedEvent"
} Because currently I have to transform |
This PR only changes the Item States SSE stream, which is located at
|
Thank you for the clarification! |
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.
LGTM, thanks!
After this PR has been merged, please update the docs accordingly: https://next.openhab.org/docs/ui/widget-expressions-variables.html#expressions-overview.
I'm not sure if I have anything to add here. It seems like a good idea to me and will make expressions in widgets at least a bit shorter if not easier to manage. |
Your approval means a great deal! |
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.
LGTM, thanks!
Is it backward compatible? Only new fields added ? Edit: looking at the code change, I have my answer. |
Refs openhab/openhab-core#4123. Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/floor-map-iconrotation-from-item-state-does-not-work/155240/5 |
This would avoid having to use parseFloat for item state by making the numericState readily available.