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

Doc update: Schedule (de)activation of load #60

Open
ghisch opened this issue Jan 24, 2025 · 3 comments
Open

Doc update: Schedule (de)activation of load #60

ghisch opened this issue Jan 24, 2025 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@ghisch
Copy link
Contributor

ghisch commented Jan 24, 2025

Hello

I want to switch on the load (regulator at 100 for example) at fixed & pre-defined schedules. The goal is to force activation of the water-heater at night. Of course you can have HomeAssistant turn on the switch with an automation, but in case of a wifi outage, it's not going to happens, and I don't want (no one wants) cold water shower. So it would be nice to be able to define schedules to activate and deactivate the load.

I was about to ask for a new feature request but realized this could be done in the config of ESPHome with the time component with something like this:

time:
  - platform: sntp
    on_time:
      - seconds: 0
        minutes: 0
        hours: 2
        then:
          - switch.turn_on: regulator_id

So I think it would be nice to have such thing in the doc :)

Thanks

@XavierBerger
Copy link
Owner

Hello,

Yes, I think it could be good to add such a thing in the doc.
Did you already test it?
Because, at first look, I think that it may work or may have a conflict with the regulation.
Also, you should think to turn it OFF ... or let the regulation manage the relay again.
I think that the idea to have it as a module is also a good one, since it will be possible to configure it inside Home Assistant (and maybe add automation to update this scheddule). But this could come in a second time.
I let you propose a PR, and I will give you my feedback.

Thanks for this proposal.

@XavierBerger XavierBerger added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 26, 2025
@ghisch
Copy link
Contributor Author

ghisch commented Jan 28, 2025

Tested this, it works great. Setup to disable the solar router then enable regulator at 100, or bypass, or 3 channels relay from midnight to 2AM.

For engine.yaml

time:
  - platform: sntp
    on_time:
      # Disable Router then set regulator to 100
      - seconds: 0
        minutes: 0
        hours: 0
        then:
          - switch.turn_off: activate
          - number.set:
              id: regulator_opening
              value: 100
      # Set regulator to 0 then re-enable Router then
      - seconds: 0
        minutes: 0
        hours: 2
        then:
          - number.set:
              id: regulator_opening
              value: 0
          - switch.turn_on: activate

For engine_regulator_with_bypass.md

time:
  - platform: sntp
    on_time:
      # Disable Router, enable bypass
      - seconds: 0
        minutes: 0
        hours: 0
        then:
          - switch.turn_off: activate
          - number.set:
              id: regulator_opening
              value: 0
          - switch.turn_on: energy_divertion
      # Disable Bypass, enable router
      - seconds: 0
        minutes: 0
        hours: 2
        then:
          - number.set:
              id: regulator_opening
              value: 0
          - switch.turn_off: energy_divertion
          - switch.turn_on: activate

For engine_3_channels_with_bypass.yaml

time:
  - platform: sntp
    on_time:
      # Disable Router, enable bypass
      - seconds: 0
        minutes: 0
        hours: 0
        then:
          - switch.turn_off: activate
          - number.set:
              id: regulator_opening
              value: 0
          - switch.turn_on: relay_1
          - switch.turn_on: relay_2
          - switch.turn_on: relay_3
      # Disable Bypass, enable router
      - seconds: 0
        minutes: 0
        hours: 2
        then:
          - number.set:
              id: regulator_opening
              value: 0
          - switch.turn_off: relay_1
          - switch.turn_off: relay_2
          - switch.turn_off: relay_3
          - switch.turn_on: activate

@ghisch
Copy link
Contributor Author

ghisch commented Feb 1, 2025

Update: When this PR will be merged, scheduling (de)activation of load(s) will be as easy as

time:
  - platform: sntp
    on_time:
      # Disable Router then set router level to 100
      - seconds: 0
        minutes: */5
        hours: 0-1
        then:
          - switch.turn_off: activate
          - number.set:
              id: router_level
              value: 100
      # Set router level to 0 then re-enable Router then
      - seconds: 0
        minutes: 0
        hours: 2
        then:
          - number.set:
              id: router_level
              value: 0
          - switch.turn_on: activate

This config will work with any current router engines (engine, engine_on_off) and any future engines.

PS: To make really sure the load is enabled, I made it so that the router_level is set to 100 every 5 min from 00:00 to 1:55 included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants