sh00t2kill / linktap_local_http_component

A Custom Component that uses the linktap local HTTP API
29 stars 4 forks source link

Timestamp of last watering session #49

Closed chadbaum closed 5 months ago

chadbaum commented 5 months ago

Any way to provide this either from TapLink's API or calcing in component and providing to HA? I've tried using the "last-updated" state of the watering entity but unfortunately it does not survive a reboot of HA which makes it useless for this purpose.

sh00t2kill commented 5 months ago

I quickly re-checked the docs and the local API doesn't have this info.

The cloud one does but that negates the point.

You could do it with an automation and and input text helper though. (When it turns off, update helper with current time)

chadbaum commented 5 months ago

Good idea! I'll work on that. Thanks for this component, took all of 2 seconds to get working. I spent like 3 years raging at my Bhyve timers because they just sucked and barely worked. These things are rock solid and worth every penny.

sh00t2kill commented 5 months ago

I might add it into the integration anyway, could be useful.

Its not trivially easy, so might be something to do on a rainy day.

chadbaum commented 5 months ago

Sounds good. Not a must-have feature by any means, it's just something I used to report on my Bhyve's on my dashboard at a glance, but it was probably driven moreso by the fact that they were so damn unreliable than anything else. I can't tell you how glad I am that when I hit my button to water the lawn not only does it actually start to water the lawn, but KNOWS it is watering the lawn... in both HA and the native app. My Bhyve's were so buggy with their bluetooth connection to the hub that they'd consistently start watering like 2 minutes after the command, and after the SLA in the app would cause a timeout and never think the faucet was actually open, therefore messing up all the other features like scheduling...

I did a whole lawn renovation last year and the Bhyve's were criminally liable for attempted murder multiple times.

chadbaum commented 4 months ago

If anyone needs any tips on creating the automations to accomplish the above, here's my code. Requires a datetime helper for each sprinkler that holds a timestamp. Then if you want to display on a dashboard, you can use the simple-entity type to remove the editable fields and display it as a straight timestamp.

alias: Store last watered dates for sprinklers
description: ""
trigger:
  - type: turned_off
    platform: device
    device_id: d8e4a3fffc110b2d8043c073ae08ac65
    entity_id: ca261d5a897b9591f8ed0426c0b81d5f
    domain: binary_sensor
    id: front yard watered
  - type: turned_off
    platform: device
    device_id: 1982746244a932f597553d7d8bef6ad9
    entity_id: 8fd2a89d735a2e7ebb039083be80f51d
    domain: binary_sensor
    id: back yard watered
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - front yard watered
        sequence:
          - service: input_datetime.set_datetime
            metadata: {}
            data:
              timestamp: "{{ now().timestamp() }}"
            target:
              entity_id: input_datetime.front_yard_watered
      - conditions:
          - condition: trigger
            id:
              - back yard watered
        sequence:
          - service: input_datetime.set_datetime
            metadata: {}
            data:
              timestamp: "{{ now().timestamp() }}"
            target:
              entity_id: input_datetime.back_yard_watered
mode: single

And on entities card:

 - entity: input_datetime.back_yard_watered
   type: simple-entity