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

Changement de la conversion *100 par le prix au centime pour ajouter le sensor #39

Open
killforby opened this issue Sep 19, 2024 · 0 comments

Comments

@killforby
Copy link

killforby commented Sep 19, 2024

Bonjour , je me suis permis de modifier votre code dans template .

En effet votre code multiplier le prix *100 hors ce qui m'interresser c'était de l'avoir au centime pour pouvoir l'utiliser dans énergie et ainsi avoir une estimation du cout par rapport au prix actuel avec HC-HP

Avant modification de votre template ça afficher ceci :
image

Après modification avec adaptation du code pour inclure le prix au centime :
image

Partage de mon code adapté :

- unique_id: "tempo_time_prices" sensor: - name: "EDF Tempo Prix Actuel" unique_id: "current" device_class: 'monetary' unit_of_measurement: "€/kWh" icon: 'mdi:cash-check' availability: > {{ not 'unavailable' in [ states('sensor.rte_tempo_couleur_actuelle'), states('binary_sensor.rte_tempo_heures_creuses'), ] and not 'unknown' in [ states('sensor.rte_tempo_couleur_actuelle'), states('binary_sensor.rte_tempo_heures_creuses'), states('input_number.tarif_edf_tempo_bleu_hp'), states('input_number.tarif_edf_tempo_bleu_hc'), states('input_number.tarif_edf_tempo_blanc_hp'), states('input_number.tarif_edf_tempo_blanc_hc'), states('input_number.tarif_edf_tempo_rouge_hp'), states('input_number.tarif_edf_tempo_rouge_hc') ] }} state: > {%- if is_state('sensor.rte_tempo_couleur_actuelle', "Bleu") %} {%- if is_state('binary_sensor.rte_tempo_heures_creuses', 'off') %} {{ states('input_number.tarif_edf_tempo_bleu_hp') | float | round(4) }} {%- else %} {{ states('input_number.tarif_edf_tempo_bleu_hc') | float | round(4) }} {%- endif %} {%- elif is_state('sensor.rte_tempo_couleur_actuelle', "Blanc") %} {%- if is_state('binary_sensor.rte_tempo_heures_creuses', 'off') %} {{ states('input_number.tarif_edf_tempo_blanc_hp') | float | round(4) }} {%- else %} {{ states('input_number.tarif_edf_tempo_blanc_hc') | float | round(4) }} {%- endif %} {%- elif is_state('sensor.rte_tempo_couleur_actuelle', "Rouge") %} {%- if is_state('binary_sensor.rte_tempo_heures_creuses', 'off') %} {{ states('input_number.tarif_edf_tempo_rouge_hp') | float | round(4) }} {%- else %} {{ states('input_number.tarif_edf_tempo_rouge_hc') | float | round(4) }} {%- endif %} {%- else %} 0 {%- endif %} - name: "EDF Tempo Prochain Prix" unique_id: "next" device_class: 'monetary' unit_of_measurement: "c€/kWh" icon: 'mdi:cash-clock' availability: > {{ not 'unavailable' in [ states('sensor.rte_tempo_couleur_actuelle'), states('sensor.rte_tempo_prochaine_couleur'), states('binary_sensor.rte_tempo_heures_creuses'), ] and not 'unknown' in [ states('sensor.rte_tempo_couleur_actuelle'), states('sensor.rte_tempo_prochaine_couleur'), states('binary_sensor.rte_tempo_heures_creuses'), states('input_number.tarif_edf_tempo_bleu_hp'), states('input_number.tarif_edf_tempo_bleu_hc'), states('input_number.tarif_edf_tempo_blanc_hp'), states('input_number.tarif_edf_tempo_blanc_hc'), states('input_number.tarif_edf_tempo_rouge_hp'), states('input_number.tarif_edf_tempo_rouge_hc') ] }} state: > {%- if is_state('sensor.rte_tempo_prochaine_couleur', "Bleu") %} {%- if is_state('binary_sensor.rte_tempo_heures_creuses', 'on') %} {{ states('input_number.tarif_edf_tempo_bleu_hp') | float | round(4) }} {%- else %} {{ states('input_number.tarif_edf_tempo_bleu_hc') | float | round(4) }} {%- endif %} {%- elif is_state('sensor.rte_tempo_prochaine_couleur', "Blanc") %} {%- if is_state('binary_sensor.rte_tempo_heures_creuses', 'on') %} {{ states('input_number.tarif_edf_tempo_blanc_hp') | float | round(4) }} {%- else %} {{ states('input_number.tarif_edf_tempo_blanc_hc') | float | round(4) }} {%- endif %} {%- elif is_state('sensor.rte_tempo_prochaine_couleur', "Rouge") %} {%- if is_state('binary_sensor.rte_tempo_heures_creuses', 'on') %} {{ states('input_number.tarif_edf_tempo_rouge_hp') | float | round(4) }} {%- else %} {{ states('input_number.tarif_edf_tempo_rouge_hc') | float | round(4) }} {%- endif %} {%- else %} 0 {%- endif %}

LA template si besoin

templates.txt

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

No branches or pull requests

1 participant