for different sensors (water, gas, energy, rain, …) I always create the same pages: A tabbed page with 3 chart pages in the tabs (annual, monthly, daily).
But these are 4 pages for every sensor. It would be much better to have parameterized pages that can be reused.
Does anyone know of a way how this could be implemented?
I’m also missing something lika a day, week, month, year, decade button in the aggregate charts.
I think we need to request this. Not sure how we can do that.
Pages can take advantage of the
vars system for widgets. So in a page you can have multiple widgets that all use the same variable. When you are linking to a page from some other widget it is possible to set those page variables using the
Here’s and example. I have a page that generates a list of items. I want to be able to click on each item in that list and open the same page but using that item. So each item in the list looks like this:
- component: oh-list-item
The action for this item is to navigate to a page called
details_page. When it does, it also sets the
pageItem item variable for that page as the name of an item.
details_page there’s a widget that is defined like this:
label: Sensor Details
- component: oh-block
- component: oh-grid-row
- component: oh-grid-col
- component: widget:sensor_details
sensor: =vars.pageItem || 'gBasicSensor'
That widget has a
sensor property and that sensor property will be set to the page variable
pageItem (or a default value if
pageItem does not exist). So, when this page is called by a click on one of the list items above it gets opened and passed the value from the list to the page’s widget using the