Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Winter credit #61

Open
ohmer1 opened this issue Dec 18, 2020 · 9 comments
Open

Winter credit #61

ohmer1 opened this issue Dec 18, 2020 · 9 comments

Comments

@ohmer1
Copy link

ohmer1 commented Dec 18, 2020

Is there plan to add winter credit support? I would be interested to know when there is peak event.

https://www.hydroquebec.com/residentiel/espace-clients/tarifs/option-credit-hivernal.html

@dgagnon720
Copy link

same for me, my openhab is ready but I need to activate it manually. It would be nice to have a status for it.

@roger1233
Copy link

If I can help (test or otherwise) let me know and I'll be happy to.

@tech165
Copy link

tech165 commented Feb 13, 2021

I created a PR for this, you will see the message you see in your account for today and tomorrow in 2 new MQTT sensors or with command line. You will need to process the message to extract the time in your Home Assistant (or anything else).

@roger1233
Copy link

I just downloaded the PR, for now my "today_message", today_times and tomorrow_message and tomorrow_times are "unknown" in Home Assistant, I imagine because there is no message for today or tomorrow, but I'll update when I get one, and how I integrate this with HA.

For now, I have a node-red flow that executes at each 6 hours, that check my unread mails and applies a regex on the hydro message to get the times. It works, but I'd like to get rid of that.

@tech165
Copy link

tech165 commented Feb 14, 2021

Hi, yes the "unknown" is because there is nothing yet today. For home assistant I use this automation :

- id: 'xxxxxxxxxxx'
  alias: Tarif Dynamique Hydro-Québec AutoON AM
  description: Lire MQTT et mettre les input_boolean a ON automatique
  trigger:
  - platform: state
    entity_id: sensor.hydroquebec_xxxxxxxxx_today_times
  condition:
  - condition: template
    value_template: "{% if states(\"sensor.hydroquebec_xxxxxxxxx_today_times\") ==\
      \ \"unknown\" or  states(\"sensor.hydroquebec_xxxxxxxxx_today_times\") == \"\
      \" or states(\"sensor.hydroquebec_xxxxxxxxx_today_times\") == \"{}\" %}\n  \
      \    False\n{% else %}\n     {% set today_times = states(\"sensor.hydroquebec_xxxxxxxxx_today_times\"\
      )|from_json %}\n     {% if today_times.today_start_1 != \"\" and today_times.today_end_1\
      \ != \"\" %}\n       {% if states(\"sensor.time\") < \"{:02}:{:02}\".format(today_times.today_start_1\
      \ | int, 0) %} \n         True\n       {% else %}\n         False\n       {%\
      \ endif %}\n     {% else %}\n       False\n     {% endif %}\n {% endif %}"
  action:
  - service: input_boolean.turn_on
    data: {}
    entity_id: input_boolean.tarif_dynamique_am
  mode: single

I use this 2 of those automation (one for AM and one for PM replacing today_start_1 by today_start_2 ans end_1 by end_2) to turn on an input boolean to on. Then I have other automations based on time and with the condition that this input boolean is turned on to adjust the temperature.

With the MQTT server in docker and with the config_cron.yaml and entrypoint_cron.sh it will check at 2 am every day so well before the minimum time to turn down the heat.

@roger1233
Copy link

It works. FYI the messages are "unknown" until pyhydroquebec runs for the first time, then the today_message and tomorrow_message show empty, and the today_times and tomorrow_times have the default value of '{}' (empty json string)

When an event occurs, I get for example this: {"tomorrow_start_1": "6", "tomorrow_end_1": "9", "tomorrow_start_2": "", "tomorrow_end_2": ""} which i run through JSON.parse in a nodered function, to get the values, and then act accordingly.

Nice, thank you very much, I can confirm this works well, and on top of it, I'm over 130$ in credits this winter!

@djiesr
Copy link

djiesr commented Dec 22, 2021

I search a solution for Hydro Flex with the 2 last lines

https://cl-ec-spring.hydroquebec.com/portail/fr/group/clientele/portrait-de-consommation/resourceObtenirInfoCommunPortrait
{
"success": true,
"results": {
"codeTarif": "DPC",
"adresseLieuConsoPartie1": "## av ",
"adresseLieuConsoPartie2": "
*** QC #*# #",
"codeUsageContrat": "R",
"indContratPuissance": false,
"echelleMinTemp": -19,
"echelleMaxTemp": 29,
"echelleMinTempHeure": -24.40,
"echelleMaxTempHeure": 35.10,
"echelleMinTempMois": -7,
"echelleMaxTempMois": 24,
"echelleMinTempPeriode": -6,
"echelleMaxTempPeriode": 22,
"echelleMinKwhPeriode": 0,
"echelleMaxKwhPeriode": 4285,
"echelleMinKW": 0,
"echelleMaxKW": 10,
"echelleMinDollar": 0,
"echelleMaxDollar": 398.04,
"echelleMinKwhJour": 0,
"echelleMaxKwhJour": 108,
"echelleMinKwhHeure": 0,
"echelleMaxKwhHeure": 10,
"echelleMinKwhMois": 0,
"echelleMaxKwhMois": 2267,
"dateDebutPeriodeInitiale": null,
"indEcranInitialHistJourPuissance": false,
"indRetirerVueEnergieHeure": false,
"zoneMessageHTMLAvisAujourdhui": "",
"zoneMessageHTMLAvisDemain": "le 23 décembre, réduisez votre consommation d’électricité de\u0026nbsp;6 h\u0026nbsp;à\u0026nbsp;9 h."

}
}

@tech165
Copy link

tech165 commented Dec 22, 2021

Hi, I made a pull request for this last year. It is already working in my fork.

Thanks

@roger1233
Copy link

Strange as it seems, I was running https://github.com/titilambert/pyhydroquebec and applying the PR for the winter credit, but it does not work anymore. What I mean is that that pyhydroquebec works, but the home assistant hydroquebec_xxxxxxxxx_today_message and others are undefined now. Same code was working last year.

So I switched to using directly https://github.com/tech165/pyhydroquebec and the topics are back. If this can help someone.

I wonder why this change has not been merged to the "official" pyhydroquebec yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants