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

Tasmota Pulsetime Support #178

Open
edoardop13 opened this issue Aug 16, 2024 · 6 comments
Open

Tasmota Pulsetime Support #178

edoardop13 opened this issue Aug 16, 2024 · 6 comments

Comments

@edoardop13
Copy link

edoardop13 commented Aug 16, 2024

Hi, thank you for this nice project.

I was trying to implement it and design a new ui lovelace/mushroom card but I noticed that the script that turn on the valves doesn't have tasmota pulsetime support.

I use the pulsetime function in Sonoffs with Tasmota because if Home Assistant or internet fail I'm sure the valve will close.

This is an example of code with pulsetime

- service: mqtt.publish
        data_template:
          topic: >
            cmnd/{{ sonoff }}/pulsetime{{ valve }}
          payload: >
            {% set seconds = states('sensor.irrigation_' ~ cycle ~ '_' ~ zone ~ '') | int %}
            {% if seconds <= 11 %}
              {% set payload = 10 * seconds %}
            {% else %}
              {% set payload = 100 + seconds %}
            {% endif %}
            {{ payload | int }}

{{ sonoff }} is the name of the sonoff
{{ valve }} is the number: 1,2,3 or 4

For the payload the script get the seconds that the user set and convert as indicated in the tasmota documentation.

Yes, I can create an automation that track the irrigation unlimited sensor for a specific zone and send this mqtt command, but is nicer that if it is possible this support is included in the irrigation unlimited integration.

@rgc99
Copy link
Owner

rgc99 commented Aug 16, 2024

Can you set up a Home Assistant MQTT switch like here?

@edoardop13
Copy link
Author

edoardop13 commented Aug 16, 2024

Yes, this is one switch:

- name: "Prato 2"
  state_topic: "stat/sonoff-elettrovalvole2/POWER4"
  command_topic: "cmnd/sonoff-elettrovalvole2/POWER4"
  availability_topic: "tele/sonoff-elettrovalvole2/LWT"
  icon: mdi:water-pump
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  retain: false

But doesn't works with pulsetime. It's a simple switch. Pulsetime require the amount of seconds for the ON state.
The only way that I found is make an automation that track the irrigation unlimited sensor or change the irrigation unlimited code.

@xal88
Copy link

xal88 commented Aug 18, 2024

Hello,
have used an automation with state trigger and notify to set tasmota pulsetime. Using default of 15 min otherwise.

Automation:

alias: Relais Update Timer
description: Set relais timer, default to 15 min
trigger:
  - platform: state
    entity_id: binary_sensor.irrigation_unlimited_c1_z1
    to: "on"
condition: []
action:
  - variables:
      target: "{{'PulseTime' + state_attr( trigger.entity_id ,'relais')[1:] + '%20' }}"
      cmd: |-
        {% if state_attr( trigger.entity_id ,'current_duration') is none %}
          {{ target + '1000' }}
        {% else %}
          {% set t1 = state_attr( trigger.entity_id,  'current_duration') %}     
          {{ target + ( ( (t1.split(':')[0] | int *60 + t1.split(':')[1] | int ) * 60 ) + int(100) ) | string }}    
        {% endif %}
  - service: notify.gardenrelais
    data:
      message: "{{ cmd }}"
      title: Irrigation pulseTime update

Notify:

notify:
  - name: gardenrelais
    platform: rest
    resource: http://172.21.12.206/cm
    message_param_name: cmnd

Maybe this helps for a quick solution.

BR Alf

@edoardop13
Copy link
Author

edoardop13 commented Aug 18, 2024

Hello, have used an automation with state trigger and notify to set tasmota pulsetime. Using default of 15 min otherwise.

Automation:

alias: Relais Update Timer
description: Set relais timer, default to 15 min
trigger:
  - platform: state
    entity_id: binary_sensor.irrigation_unlimited_c1_z1
    to: "on"
condition: []
action:
  - variables:
      target: "{{'PulseTime' + state_attr( trigger.entity_id ,'relais')[1:] + '%20' }}"
      cmd: |-
        {% if state_attr( trigger.entity_id ,'current_duration') is none %}
          {{ target + '1000' }}
        {% else %}
          {% set t1 = state_attr( trigger.entity_id,  'current_duration') %}     
          {{ target + ( ( (t1.split(':')[0] | int *60 + t1.split(':')[1] | int ) * 60 ) + int(100) ) | string }}    
        {% endif %}
  - service: notify.gardenrelais
    data:
      message: "{{ cmd }}"
      title: Irrigation pulseTime update

Notify:

notify:
  - name: gardenrelais
    platform: rest
    resource: http://172.21.12.206/cm
    message_param_name: cmnd

Maybe this helps for a quick solution.

BR Alf

Yes, this is the quickest solution, but I don't understand why the notify.

@xal88
Copy link

xal88 commented Aug 19, 2024

Yes, this is the quickest solution, but I don't understand why the notify.

Because I want to notify Tasmota how long it should open the zone relais, so the watering is not running endless if the close command does not arrive ( or someone klicks in the relais controll manually, then it stops after 15 minutes ).
And the MQTT commands did not work reliable for me.

@edoardop13
Copy link
Author

Yes, this is the quickest solution, but I don't understand why the notify.

Because I want to notify Tasmota how long it should open the zone relais, so the watering is not running endless if the close command does not arrive ( or someone klicks in the relais controll manually, then it stops after 15 minutes ). And the MQTT commands did not work reliable for me.

Okay, so it's the same thing of my code with mqtt.publish in the first message

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

3 participants