--
You received this message because you are subscribed to the Google Groups "openhab" group.
To post to this group, send email to ope...@googlegroups.com.
To unsubscribe from this group, send email to openhab+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openhab?hl=en.
Well, it would be ugly, there's no way. But maybe I'll try to cut a frame with a CNC router machine... I have one by me and it's worth a try :) Which open source hardware you plan to use? Something like BeagleBoard / PandaBoard?
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/QW-Is8c6aO0J.
Is that a matter of the learning curve or of a bad design? If you have
any feedback on how to improve the REST-API, let me know :-)
> To read the values, you have two options. If you read them from the item,
> you will get raw values like an integer: "5", but if you get them from the
> sitemap (as I do) you will get the strings ready to be shown, e.g.: "5º C".
All textual representation should be taken from the sitemap, because
that is the formatted version that can be defined by the user (and if
the user leaves out the [] part in the label, it even means that he
does not want to show a textual representation of the state. The icon
might e.g. be good enough for an open/closed window).
So the "raw data" of the item should only be used to do the
"graphical" parts of the widget, e.g. setting the switch to the right
position, placing the handle of a slider etc.
> To refresh the values, you can just get the whole sitemap. You could get
> just a branch, but I suggest you to get the full sitemap. It is easier and
> you get all the updates in one network call.
That's imho not a good strategy at all! The idea of the REST API is
that you always only display a single page of the sitemap and thus you
should always only poll for changes of this currently visible page
(see the very last example on the REST wiki page). Polling the whole
sitemap causes many more request (as it will also send a response if a
value on another page has changed) and more data transfer
(transferring always all pages instead of the currently visible one).
> P.D.: Kai and Thomas, programming Android should be reaaaally easy for you,
> as it is java! You just have to understand the basic concepts (intents,
> etc.) and there you are!
Right, it is indeed not the technology that kept me away from doing
it, but the lack of time :-)
Regards,
Kai
You should definitely not only react on user activity - the page
should be automatically refreshed, whenever an item changes its state,
so buttons might be switched automatically if a light wents on,
temperature values are updated, etc.
Pablo cheated here for the iOS UI - he simply sends new requests in a
fixed interval and then updates the widgets accordingly.
The Classic UI and the Sencha Touch UI use the recommended approach:
The so-called long-polling/server-push requests. I just noticed that
this is not yet mentioned on the REST Wiki page (I must have missed to
add this), so the details are only in the issue tracker for the
moment: http://code.google.com/p/openhab/issues/detail?id=46
The idea here is simply that you can do a request for a page of the
sitemap with a special HTTP header, which will cause the server to
suspend the response and only send it once some state has changed on
it. So you can simply send such a request after initially rendering
your page and you know that whenever you receive a response, it is
time to update the page and send the next polling-request. This
reduces the number of requests to a minimum, while ensuring that your
UI is instantly updated upon a change of an item.
You can see this nicely if you use the Classic UI and the Sencha Touch
UI side by side - you switch something on the one UI and you see the
instant update on the other.
Regards,
Kai
Yep, that is the right mechanism and I am going with a service then. Does this polling return only events happened?
Sent from my iPad
> --
> You received this message because you are subscribed to the Google Groups "openhab" group.
It returns exactly the same result as without the HTTP header - the
only difference is the suspension of the response until an event occurs.
So you get always the information of the full page incl. all
widgets/items which have not changed.
If you are interested in getting a streamed feed of change events
instead, you should have a look at this issue:
http://code.google.com/p/openhab/issues/detail?id=62
Oliver is about to finish it, so this feature should be available soon
(Mihail is impatiently waiting for it ;-)).
Regards,
Kai
This is only true with your (cheated!) approach to do updates with a
fixed interval. As soon as you use server-push, it definitely does not
make sense that you get server responses for changes that are not
visible at all (and that are relevant for a page that the user will
never look at). The bigger the sitemap gets, the more this will become
a problem.
Take the example of my "power metering" page: The items on this page
get in average an update every second. While I am on this page, I want
to immediately see these changes, so that I can directly see the
result of turning on a light for example. But while I am on any other
page (e.g. the homepage, which might be opened all day long), I do not
want to have a full sitemap transferred every second - ideally, there
should be no traffic at all as long as nothing changes on the homepage.
> But the best approach, as Kai says, is to subscribe to the push
> notifications of the server. Then, there is no point in making
> requests each x seconds as the iOS client does. I did it this way
> because the lack of time.
Agreed, but this means that when changing the page, you will have to
execute an update request for the next page to display (assuming that
you do not always subscribe for ALL changes, which does not make sense
as explained above).
> BTW Victor, you will notice that Kai has clear ideas of how openHAB
> clients should be and it is difficult to convince him, ;)
That's not true! I can be very easily convinced by good arguments,
have a try :-D
Regards,
Kai
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To post to this group, send email to ope...@googlegroups.com.
To unsubscribe from this group, send email to openhab+unsubscribe@googlegroups.com.
But there are scenarios where you need to get information about items not on the screen too. Ideally the mechanism of interaction between the application and openHAB should look like getting information on the current state of everything and then using push to get events on changes happening. Changes about everything. Imagine alarm going on. A UI application could react on that not depending on if user is on the alarm page. There are other usage scenarios too…
And in the future, if items and site maps will be stored in dynamic persistent storage instead of files and there will be API for adding/editing/deleting them, this push mechanism should also deliver the information about that changes to dynamically change it on client side (and by the way internally in openHAB different subsystems should also get this events to reconfigure).
Anyway, I tried the existing mechanism and it didn't work :-) What am I doing wrong? :curl -H "X-Atmosphere-Transport: long-polling" http://demo.openhab.org:8080/rest/sitemaps/demo/FF_Bath
I agree that there are scenarios where you want the UI to be informed even if it is not related to the current page. I do not agree that this should all be done through the sitemap&item REST API. Actually, I was thinking about introducing a notification API. You could send notifications from rules and others can subscribe to any sent notification. This could be any UI, the XMPP connection or whatever. This way, the user defines once on the server side what kind of notifications he wants and what kind of severity they have. If you start trying to do this in the UI (take your example where the alarm goes off - how would the UI know that this is a special item it should launch a popup message for?) you would have to configure this somewhere in the UI and you would end up with a lot of logic there - and the user would have to do the same for all other UIs as well.
Loading and parsing the whole sitemap data on a given short interval is an ugly cheat. Sorry, Pablo :-) I don't even like how suspended requests are implemented right now, and it's not only me. That's why Oliver works on a new streaming API (http://code.google.com/p/openhab/issues/detail?id=62) that will use HTTP streaming and websockets and a new data format for the statuses.
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/r4x7Kd_SN10J.
To unsubscribe from this group, send email to openhab+u...@googlegroups.com.
Just wanted to do a small update on HABDroid. I finished the code for what I wanted but found some crazy bug in openHAB long-polling response which breaks the UI. As soon as we resolve it and I check it - I will publish the code. Just wait a little bit! :-)
For now HABDroid supports browsing the whole sitemap with most of widgets and sends on-off commands to switches. Updates use long-polling so it works almost realtime when displaying item changes.
Sent from my iPad
Hi,Just wanted to do a small update on HABDroid. I finished the code for what I wanted but found some crazy bug in openHAB long-polling response which breaks the UI. As soon as we resolve it and I check it - I will publish the code. Just wait a little bit! :-)
For now HABDroid supports browsing the whole sitemap with most of widgets and sends on-off commands to switches. Updates use long-polling so it works almost realtime when displaying item changes.Sent from my iPad