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

ApexCharts card #10

Open
Bergerie opened this issue Mar 19, 2021 · 2 comments
Open

ApexCharts card #10

Bergerie opened this issue Mar 19, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@Bergerie
Copy link

Could the sensor output format be made compatible with the ApexCharts card, which would allow elaborate card option features.

@aex351 aex351 added the enhancement New feature or request label Mar 19, 2021
@aex351
Copy link
Owner

aex351 commented Mar 19, 2021

ApexCharts Card uses two types of input to plot a graph: 1) history data 2) data_generator (your own input - future data). The custom sensors (Buienalarm and Buienradar) are future data (not history data). This means you should be able to use the data_generator function and write your own input function for ApexCharts Card to convert the data from the custom sensors.

For the Neerslag Card / this project, the current focus is on converting the custom sensors (Buienalarm and Buienradar) in to a custom integration. This would make the setup of the Neerslag Card much easier as the user doesn't need to set-up custom sensors. In this proces I will have a look at storing history data, this probably would make the usage with other card (i.e. ApexCharts Card) easier. However, this still is history data and not future data.

@watermarkhu
Copy link

For anyone interested, below I've attached the javascript snippets to put into the data_generator field of the ApexCharts card. Since the data from the Buienradar and Buienalarm sensors are different, each has its own data_generator.

Buienradar:

return entity.attributes.data.split(" ").map(item => {
  return [moment(item.split("|")[1], 'HH:mm').valueOf(), Math.round(Math.pow(10, ((parseInt(item.split('|')[0] - 109) / 32))) * 100) / 100]
});

Buienalarm:

return entity.attributes.data.precip.map((item, index) => {
  return [moment.unix(entity.attributes.data.start).add(index*entity.attributes.data.delta, 's').valueOf(), item]
})

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
None yet
Development

No branches or pull requests

3 participants