Retrieving of EDF electricity pricing information using eedomus

Share

Introduction

tempo_eedomusThe following php script is based on work done by Djmomo which is available through the links below. Djmomo propose a script that have to be installed on a personnal server or a NAS.

For several months, eedomus controller can run php scripts. The entire list of php librairies is not installed on eedomus, meaning that Djmomo scripts can’t be run directly on eedomus. I then propose an adapted version of it which is compatible with eedomus.

The php script

This script can be downloaded here.

To install it please refer to eedomus documentation.

When installed, here is data feedback given when calling the script :

Script calling http://192.168.xxx.xxx/script/?exec=tempo-ejp-eedomus.php
Returned Data <?xml version="1.0" encoding="UTF-8"?>
<ejp_tempo>
  <update>2015-04-05 21:15</update>
  <nord>
    <aujourdhui>non</aujourdhui><demain>non</demain><jours_restants>0</jours_restants>
  </nord>
  <paca>
    <aujourdhui>non</aujourdhui><demain>non</demain><jours_restants>0</jours_restants>
  </paca>
  <ouest>
    <aujourdhui>non</aujourdhui><demain>non</demain><jours_restants>0</jours_restants>
  </ouest>
  <sud>
    <aujourdhui>non</aujourdhui><demain>non</demain><jours_restants>0</jours_restants>
  </sud>
  <tempo>
    <aujourdhui>bleu</aujourdhui><demain>bleu</demain><bleu_restant>146</bleu_restant><bleu_total>300</bleu_total><blanc_restant>1</blanc_restant><blanc_total>43</blanc_total><rouge_restant>0</rouge_restant><rouge_total>22</rouge_total>
  </tempo>
</ejp_tempo>

Creating virtual sensors

loceedomus1_eedomusadddeviceWe have now to retrieve the values contained into xml and store them in virtual sensors, called “http sensors”. Those sensors will be available for display and to trigger rules. For each interesting value into xml, we have to create one http sensor.  To add this sensor, use option “Add or remove a peripheral” into configuration page.

smartvoice_eedomus_configuration

Select “Add another type of sensor”, this one being an HTTP sensor with this icon :

Capteur_http

Here are the parameters to be set in one of those sensors for edf tempo option :

tempo_config_capteur_http

The “Xpath” can have those values :

  • Firstly, for ejp option which depends on location :
/ejptempo/nord/aujourdhui /ejptempo/paca/aujourdhui /ejptempo/ouest/aujourdhui /ejptempo/sud/aujourdhui
/ejptempo/nord/demain /ejptempo/paca/demain /ejptempo/ouest/demain /ejptempo/sud/demain
/ejptempo/nord/jours_restants /ejptempo/paca/jours_restants /ejptempo/ouest/jours_restants /ejptempo/sud/jours_restants
  • then for tempo option :
/ejp_tempo/tempo/aujourdhui /ejptempo/tempo/bleu_restant /ejptempo/tempo/blanc_restant /ejptempo/tempo/rouge_restant
/ejp_tempo/tempo/demain /ejptempo/tempo/bleu_total /ejptempo/tempo/blanc_total /ejptempo/tempo/rouge_total

The numerical type sensors ( example : …/jours_restants) will have to have type equal to “Decimal number”. For the other values, you must define all accepted values in the list of values associated to the sensor. Here are the values corresponding to /ejp_tempo/tempo/aujourdhui  xpath :

tempo_aujourdhui_listedevaleurs

Update of http sensor

It’s possible to setup a delay between updates for each sensor. Proposed php script is using quite a big amount of resources from eedomus, computing is taking several seconds. It’s then not possible to update all sensors too quickly, we shoud set long refresh time, or no automatic update.

Sensor update can be triggered by a rule at the best period of time. In this case, we know that values are changing after 5PM and after midnight, and we want to be sure to have updated values at lunch. A rule will then trigger the updates at selected period.

tempo_regle_maj_capteurYou can see that I update several times the value in the critical periods to prevent unexpected problem  ( server overload, adsl overload, …)

Conclusion

It’s now possible to have electricity pricing conditions for edf ejp or tempo options available on our smarthome controller, without investment in some hardware. A personal server is not necessary although, the script being launched by eedomus. Be careful however, this script is analysing a web page on EDF website and retrieves values from there.  This is an heavy task, then using a personnal server is still the prefered solution if one is available.

 

Share

Vincent Recipon

Propriétaire de ce blog. Owner of this blog.

You may also like...

2 Responses

  1. Monday April 20th, 2015

    […] Lire l’article complet. […]

  2. Thursday October 22nd, 2015

    […] 1 an j’utilisais le script présenté sur mon blog pour récupérer les informations EDF relatives aux tarifs du jour. Malheureusement ce script ne […]

Leave a Reply

Your email address will not be published. Required fields are marked *