[France] AirPaca, EcoWatt, Pollens and Vigilance bindings

Hello,

JeeDom has several bindings for french local services that I would like to add into OpenHab.

I already wrote parsers for these data and I will soon come back to you with a functional binding.

Do you see any other french local data that you would like to have in OpenHab ?

Vincent

Before writing a whole new binding for these services, please make sure the information you are pulling out of them cannot be obtained using the HTTP binding with a transform (XSLT, REGEX, etc.). There are already sooo many bindings and it is difficult to keep track of, update, and maintain them all. It is actually counter productive to create new bindings that do not do anything that one can use some other binding to easily implement.

Obviously I don’t know these services but if they require special authentication to get the data from them, an API key, only support HTTPS, etc then that would make them a good candidate for a new binding. But if it is just screen scraping a public web page the HTTP binding with a transform is more appropriate. You can post your parser on the wiki in the examples section.

Also, if you do end up making a new binding, be sure to create it following the OH 2 approach. You can find out more on that on the Eclipse SmartHome project.

I will check if I can do a simple transform.
All these site have no machine-to-machine API, I parse HTML and/or images.
I used a lot of JQuery like parsing, not the kind of stuff you can do easily with a regexpr.

The goal is not to make an official binding in OpenHab repo but to advise this plugin exist and is maintained elsewhere.
For a local usage there is no need to involve the whole community.
I hope the topic and the source code will motivate other devs to integrate local service or open-data for their own usage.

Thanks for the remark on OH2.

Is the HTML you are parsing well formed so that XSLT transforms could be performed on it? If so, then the HTTP binding could be configured to poll and cache, so each item could use a different XSLT transform to scrape the values you want.

EcoWatt algorithm:

  • Download http://www.ecowatt-paca.fr/restez-au-courant/alertes-2/
  • Find first <div class="alerte">
  • Find first <img> inside the div
  • Get the alt attribute of the image
  • Parse second word from enum ["vert", "orange" "rouge"] for today
  • Parse third word from enum ["vert", "orange" "rouge"] for today
    This one could probably be written as an XSLT

AirPaca algorithm (may be modified soon)

  • Download http://www.atmopaca.org/atmo/indice_atmo.php
  • Find <table class="resulttable">
  • Analyze lines to detect city (can change every day)
  • Analyze rows for type of measure (can change every day)
    This one probably needs to stay in Java.

Vigilence (weather alert) algorithm:

  • Download http://vigilance.meteofrance.com/data/NXFR33_LFPW_.xml
  • Find a location by filtering on <DV dep="%s">
  • Read risk level using attribute <DV coul="%d">
  • Read risk type using sub tags <risque val="%d">
    Maybe we could have it in XSLT but it use A LOT of non documented enum,

Pollen algorithm: