Advertisement
seston

Nordpool pumba käivitamine

Sep 15th, 2022
1,231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.80 KB | Science | 0 0
  1.  
  2. # Loads default set of integrations. Do not remove.
  3. default_config:
  4. # Text to speech
  5. tts:
  6.   - platform: google_translate
  7.  
  8. automation: !include automations.yaml
  9. script: !include scripts.yaml
  10. scene: !include scenes.yaml
  11. #sensor: !include sensors.yaml
  12. #secret: !include secrets.yaml
  13. lovelace:
  14.   resources:
  15.   - url: /local/apexcharts-card.js?v=1.10.0
  16.     type: module
  17. template:
  18.   - sensor:
  19.     - name: keskminetemp
  20.       unique_id: keskminetemp
  21.       state: >-
  22.         {% set list=state_attr('weather.openweathermap', 'forecast') %}
  23.         {{ ((list[0].temperature + list[3].temperature + list[7].temperature + list[11].temperature) / 4)|round(1) }}
  24.        
  25.   - sensor:
  26.     - name: keskminetemp_real_feel
  27.       unique_id: keskminetemp_real_feel
  28.       state: >-
  29.         {% set list=state_attr('weather.openweathermap', 'forecast') %}
  30.         {% set temp_rf_0=13.2+0.6215*list[0].temperature-11.37*(list[0].wind_speed**0.16)+0.3965*list[0].temperature*(list[0].wind_speed**0.16)|float %}
  31.         {% set temp_rf_4=13.2+0.6215*list[4].temperature-11.37*(list[4].wind_speed**0.16)+0.3965*list[4].temperature*(list[4].wind_speed**0.16)|float %}
  32.         {% set temp_rf_8=13.2+0.6215*list[8].temperature-11.37*(list[8].wind_speed**0.16)+0.3965*list[8].temperature*(list[8].wind_speed**0.16)|float %}
  33.         {% set temp_rf_12=13.2+0.6215*list[12].temperature-11.37*(list[12].wind_speed**0.16)+0.3965*list[12].temperature*(list[12].wind_speed**0.16)|float %}
  34.         {{ ((temp_rf_0+temp_rf_4+temp_rf_8+temp_rf_12)/4)|round(1) }}
  35.  
  36.   - sensor:
  37.     - name: heatrequest
  38.       unique_id: heatrequest
  39.       state: >-
  40.         {% set req_hours = (states('sensor.keskminetemp_real_feel')|int - 6) * -0.5 + 6 + states('input_number.pumbatunnid_input')|int %}
  41.         {% if (req_hours > 24) %}
  42.            req_hours=24
  43.         {% elif (req_hours < states('input_number.pumbatunnid_min_input')|int) %}
  44.           {% set req_hours=states('input_number.pumbatunnid_min_input')|int %}
  45.         {% endif %}
  46.         {{ req_hours|int }}
  47.  
  48.  
  49.   - binary_sensor:
  50.       - name: pumba taimer
  51.         unique_id: pumba taimer
  52.         state: >-
  53.           {% set l=state_attr('sensor.nordpool_mwh_ee_eur_3_10_02', 'raw_today')|sort(attribute='value') %}
  54.           {% set t = now() %}
  55.           {% for i in range(states('sensor.heatrequest')|int) %}
  56.             {% if (t >= l[i].start and t <= l[i].end) %}
  57.               {{ true }}
  58.             {% endif %}
  59.           {% endfor %}
  60. #  - binary_sensor:
  61. #      - name: pumba taimer
  62. #        unique_id: binary_sensor.pumba_taimer
  63. #        state: >-
  64. #          {% set l=state_attr('sensor.nordpool_mwh_ee_eur_3_10_02', 'raw_today')|sort(attribute='value') %}
  65. #          {% set t = now() %}
  66. #          {% if (states('input_number.minhind_input')|int > states('sensor.nordpool_mwh_ee_eur_3_10_02')|int) %}
  67. #          {{ true }}
  68. #          {% else %}
  69. #          {% for i in range(states('sensor.heatrequest')|int) %}
  70. #          {% if (t >= l[i].start and t <= l[i].end) %}
  71. #          {{ true }}
  72. #          {% endif %}
  73. #          {% endfor %}
  74. #          {% endif %}
  75.          
  76.        
  77.   - sensor:
  78.       - name: odavhind
  79.         unique_id: odavhind
  80.         state: >-
  81.           {% set l=state_attr('sensor.nordpool_mwh_ee_eur_3_10_02', 'raw_today')|sort(attribute='value') %}
  82.           {{ l[states('sensor.heatrequest')|int-1].value }}
  83.          
  84.        
  85. switch:
  86.   - platform: rpi_gpio
  87.  
  88.     ports:
  89.       17: soojuspump
  90.       18: reserv  
  91. automation Soojuspumba juhtimine:
  92.     initial_state: 'on'
  93.     alias: Soojuspumba juhtimine
  94.     trigger:
  95.       - platform: state
  96.         entity_id: binary_sensor.pumba_taimer
  97.         to: 'on'
  98.       - platform: state
  99.         entity_id: binary_sensor.pumba_taimer
  100.         to: 'off'
  101.     action:
  102.       - service_template: 'switch.turn_{{trigger.to_state.state}}'
  103.         entity_id: switch.soojuspump
  104.  
  105. automation Soojuspumba juhtimine2:
  106.     alias: kontroll
  107.     trigger:
  108.       - platform: time
  109.         at:
  110.        - '00:01:00'
  111.     condition:
  112.       condition: state
  113.       entity_id: binary_sensor.pumba_taimer
  114.       state: "on"
  115.     action:
  116.       - service: 'switch.turn_on'
  117.         entity_id: switch.soojuspump
  118.        
  119. input_number:
  120.   pumbatunnid_input:
  121.     name: pumbatunnid_input
  122.     min: -3
  123.     max: 3
  124.     step: 1
  125.     unit_of_measurement: h
  126.   pumbatunnid_min_input:
  127.     name: pumbatunnid_min_input
  128.     min: 0
  129.     max: 5
  130.     step: 1
  131.     unit_of_measurement: h
  132.  
  133. sensor:
  134.   - platform: nordpool
  135.     low_price_cutoff: 1
  136.     VAT: true
  137.     region: "EE"
  138.     precision: 3
  139.     price_type: MWh
  140.     additional_costs: '{% set s = { "day": 34000, "night": 19500 } %} {% if now().weekday() in (5,6) %} {{s.night|float}} {% else %} {% if now().hour >= 7 and now().hour < 22%} {{s.day|float}} {% else %} {{s.night|float}} {% endif %} {% endif %}'
  141.    
  142.  
Tags: nordpool
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement