Closed rhgiter closed 5 months ago
Why would you want to update it every 15 minutes? What's your goal here?
if the cheapest hour for my dishwasher starts at 22:00 and i set it to pause mode at 22:01 your programit starts 22:30, and then it would be better 22:15 or ex, 22.05
just add setting the dishwasher to pause mode as an additional trigger
how ? with the above I get at sensor with the time stamp when dishwasher starts at the cheapest point (name: Opvaskemaskine Start Tid aften og nat) and my automation start at that time
You are using a trigger based template sensor. You can add any trigger you can use in an automation as well.
I assume your dishwasher has some mode which allows it to be started automatically. That state will be shown in HA in some sensor provided by the dishwasher integration. You can add that state change as a trigger to the trigger section of the sensor
no I use a plug to turn the dishwasher on / off
Den ons. 6. mar. 2024 kl. 08.04 skrev Martijn van der Pol < @.***>:
You are using a trigger based template sensor. You can add any trigger you can use in an automation as well.
I assume your dishwasher has some mode which allows it to be started automatically. That state will be shown in HA in some sensor provided by the dishwasher integration. You can add that state change as a trigger to the trigger section of the sensor
— Reply to this email directly, view it on GitHub https://github.com/TheFes/cheapest-energy-hours/issues/130#issuecomment-1980215572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOR4UGCAKTWYOO27F5XQVFDYW25XPAVCNFSM6AAAAABEHZ2XESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBQGIYTKNJXGI . You are receiving this because you authored the thread.Message ID: @.***>
Then trigger on that plug turning off
Do you have it working now?
No, because I cant make a condition that checks if it in the cheapest hours.
alias: opvaskemaskine billigste periode nat (4) tænd Nordpool .
description: ""
trigger:
- platform: time
at: sensor.opvaskemaskine_start_tid_aften_og_nat
condition:
- condition: state
entity_id: switch.opvaskemaskine
state: "off"
action:
- service: switch.turn_on
data: {}
target:
entity_id:
- switch.opvaskemaskine
mode: restart
Template sensor
- trigger:
- platform: time
at:
- '18:25'
- '19:28'
- '20:28'
- '20:59'
- platform: state
entity_id: switch.opvaskemaskine
to: "off"
sensor:
- unique_id: f8853830-opva
name: Opvaskemaskine Start Tid aften og nat
device_class: timestamp
state: >
{%- set sensor = 'sensor.energi_data_service' -%}
{% from "cheapest_energy_hours.jinja" import cheapest_energy_hours %}
{{ cheapest_energy_hours(sensor=sensor, hours=3.5, start='21:00', end='06:00', include_tomorrow=true, look_ahead=true) `}}
That should work in combination with your automation (unless you turn the switch off after midnight)
Thanks i was doing it my ui automation. I will try this - Thanks :-)
it dont work
same
Please don't paste images of code. Place the code itself and use code tags so the right formatting is applied. In your top screenshot the indentation is wrong. The second trigger should be indented the same as the time trigger.
Why are you using so many times to reload the template? And if it should start between 6:00 and 17:00 I would not suggest to refresh it anymore after 6:00
The second example looks correct and should not give the same error.
I think i have put the code in the right place. now i will check if it works soon. i have to refresh it more than one time, because dishwasher and washine machine runs maybe 2 or more a day
The state trigger using the switch will already achieve that
sorry , but it dont work. it only turns on ex. 13:30 14.00 14.30 not after 5 minutes
Not sure what you mean here? Why should it turn on after 5 minutes?
Not sure what you mean here? Why should it turn on after 5 minutes?
If the cheapest hour is between 13.00 and 14.00 , and I turn off my dishwasher 13.01 (so it will be ready to start at the cheapest hour) - then It would be great if it starts 13.05 (now it turns on 13.30)
It should do that.
but it dont work , when i testet it
- trigger:
- platform: time
at:
- '05:58'
- '06:28'
- '06:58'
- '07:28'
- '07:58'
- '08:28'
- '08:58'
- '09:28'
- '09:58'
- '10:28'
- '10:58'
- '11:28'
- '11:58'
- '12:28'
- '12:58'
- '13:28'
- '13:58'
- '14:28'
- '14:58'
- '15:28'
- '15:58'
- platform: state
entity_id: switch.vaskemaskine
to: "off"
sensor:
- unique_id: f8853830-1
name: Vaskemaskine 1 Start Tid dag
device_class: timestamp
state: >
{%- set sensor = 'sensor.energi_data_service' -%}
{% from "cheapest_energy_hours.jinja" import cheapest_energy_hours %}
{{ cheapest_energy_hours(sensor=sensor, hours=1, start='06:00', end='17:00', look_ahead=true) }}
can you send me the output of this:
{%- set sensor = 'sensor.energi_data_service' -%}
{% from "cheapest_energy_hours.jinja" import cheapest_energy_hours %}
{{ cheapest_energy_hours(sensor=sensor, hours=1, start='06:00', end='17:00', look_ahead=true, debug=true) }}
{"version":"5.4.1","output":"2024-03-14T13:00:00+01:00","error":false,"non_default_user_input":{"sensor":"sensor.energi_data_service","hours":1.0,"start":"06:00","end":"17:00","look_ahead":true},"set_by_macro":{"start":"2024-03-14T10:05:14+01:00","end":"2024-03-14T17:00:00+01:00","time_key":"hour","value_key":"price","no_weight_points":2},"defaults_used":{"value_on_error":null,"attr_today":"raw_today","attr_tomorrow":"raw_tomorrow","attr_all":"prices","datetime_in_data":true,"data_minutes":60,"mode":"start","time_format":null,"include_today":true,"include_tomorrow":false,"lowest":true,"latest_possible":false,"price_tolerance":0,"precision":5,"price_factor":1,"weight":null,"kwh":null,"program":null,"plot_sensor":"sensor.energy_plots","plot_attr":"energy_plots","split":false},"data_used":{"today_count":24,"tomorrow_count":0,"all_count":0,"data_count":24,"values_count":13,"datapoints_source":{"datapoints":1,"datapoints_hour":1},"datapoints_used":{"datapoints":2,"datapoints_hour":2.0}}}````
I did find a bug in how the start times were determined, that might be reason why it wasn't working properly. This is fixed in v5.4.2. which I just released. Possibly this will fix your issue as well.
perfect .-) I will try it later - I will give you feedback
edit
it worked 14.05 but not 14.10 and 14.15
Not sure what I'm looking at here. Is this the switch? Or the binary sensor?
Please let me know if this is correct.
Is that correct?
Not sure what I'm looking at here. Is this the switch? Or the binary sensor?
I will only show you that the plug for washing machine turned on 14.05 but not 14.10 and 14.15
Please let me know if this is correct.
- You have a "dumb" dishwasher/washing machine behind a smart plug.
- You want to schedule turning on these devices based on the cheapest time window by starting the device, then turning the smart plug off and turning the plug on again when the energy is cheapest
- You want to do this within a certain time frame (so eg between 6:00 and 17:00)
Is that correct?
That thats all correct.
And how is that plug turned on? I've only seen the YAML config for the template sensor giving the best time. What is your automation to turn that switch on?
I use the entity your script make
description: ""
trigger:
- platform: time
at: sensor.vaskemaskine_1_start_tid_dag
condition:
- condition: state
entity_id: input_select.vaskemaskine_1_2_3_4_timer
state: "1"
- condition: state
entity_id: switch.vaskemaskine
state: "off"
action:
- service: switch.turn_on
data: {}
target:
entity_id:
- switch.vaskemaskine
- service: input_select.set_options
data:
options: 0
target:
entity_id: input_select.vaskemaskine_1_2_3_4_timer
mode: restart
okay, there is nothing there turning the switch off. What switched it off again after 1 minute
or was that for testing purposes?
and what does the input_select do?
okay, there is nothing there turning the switch off. What switched it off again after 1 minute
I turn the machine off with a button
and what does the input_select do?
I have a button where I can select the washing time 1 - 2 - 3 - 4 hours. and 4 automations as the above so it is the cheapest 1,2,3 or 4 hours.
I would suggest to try this:
Template sensor
- trigger:
- platform: state
entity_id: switch.vaskemaskine
to: ~
sensor:
- unique_id: f8853830-1
name: Vaskemaskine 1 Start Tid dag
device_class: timestamp
state: >
{%- set sensor = 'sensor.energi_data_service' -%}
{% from "cheapest_energy_hours.jinja" import cheapest_energy_hours %}
{{ cheapest_energy_hours(sensor=sensor, hours=1, start='06:00', end='17:00', look_ahead=true) }}
availability: "{{ is_state('switch.vaskemaskine', 'off') }}"
Automation:
description: ""
trigger:
- platform: time
at: sensor.vaskemaskine_1_start_tid_dag
condition:
- condition: state
entity_id: input_select.vaskemaskine_1_2_3_4_timer
state: "1"
action:
- service: switch.turn_on
target:
entity_id:
- switch.vaskemaskine
- service: input_select.set_options
data:
options: 0
target:
entity_id: input_select.vaskemaskine_1_2_3_4_timer
mode: single
ok Thanks, I will try later
I would suggest to try this:
Template sensor
- trigger: - platform: state entity_id: switch.vaskemaskine to: ~ sensor: - unique_id: f8853830-1 name: Vaskemaskine 1 Start Tid dag device_class: timestamp state: > {%- set sensor = 'sensor.energi_data_service' -%} {% from "cheapest_energy_hours.jinja" import cheapest_energy_hours %} {{ cheapest_energy_hours(sensor=sensor, hours=1, start='06:00', end='17:00', look_ahead=true) }} availability: "{{ is_state('switch.vaskemaskine', 'off') }}"
Automation:
description: "" trigger: - platform: time at: sensor.vaskemaskine_1_start_tid_dag condition: - condition: state entity_id: input_select.vaskemaskine_1_2_3_4_timer state: "1" action: - service: switch.turn_on target: entity_id: - switch.vaskemaskine - service: input_select.set_options data: options: 0 target: entity_id: input_select.vaskemaskine_1_2_3_4_timer mode: single
Hi , I have tested it , but it dont work, turn on once , but no again ;-/
That doesn't tell me much. How does the history of the template sensor look?
Closing this issue due to lack of response