/linktap_local_http_component

A Custom Component that uses the linktap local HTTP API

Primary LanguagePython

A custom component for linktap tap and watering valve controllers.

Linktap already have an MQTT implementation, but for home assistant users its support is rudimentary. They have a more advanced mode of operation via MQTT, but it involves complicated manual setup of switches and sensors. This custom component replaces both of those mechanisms, and uses the locally available HTTP API.

It requires just the configuration IP of your gateway. If you have more than 1 gateway, you can setup multiple instances of the integration.

A device is created for each tap found. Multi-valve TapLinkers or ValveLinkers will get a device created for each output.
Note: version x060820 (x is S or G, indicating that the firmware belongs to GW-01 or GW-02, respectively) is required on your Linktap Gateway in order for this component to work.

For each device, multiple entities are created:
binary sensors:

  • Is Linked
  • Has a fall alert
  • Has a cutoff alert
  • Is leaking
  • Is clogged
  • Is broken

Binary sensors also have some services registered:
dismiss_alerts: dismiss all alerts
dismiss_alert: dismisses a single alert. Takes an entity ID of one of the binary sensors.

sensors:

  • Signal Strength
  • Battery
  • Total Duration
  • Remaining Duration
  • Speed
  • Volume
  • Volume Limit
  • Failsafe Duration
  • Plan Mode
  • Plan SN

number:

  • Watering Duration (Defaults to 15 minutes)
  • Watering Volume (Defaults to 0)

Note:The volume unit is pulled from the gateway. It can either be in L or Gal.

These control the watering time and volume, when the switch for a tap is turned on.
If duration is 0 AND volume is 0, default time is applied (currently 15 mins)
If duration is 0 AND volume is >0, water by volume is used
If duration > 0 AND volume is 0, water by duration is used
If both duration AND volume > 0, both duration AND volume are used, and tap will turn off when either is reached

NOTE: WATER BY VOLUME IS CURRENTLY PENDING A NEW RELEASE FROM LINKTAP. Until this is released, the volume parameter will have no effect.

switch:
The tap controller itself.

valve:
A wrapper for the switch -- a valve for each tap

Using the switch and the valve are functionally equivalent, and the entities should always remain in sync.

As yet there is no support for controlling scheduling. The API does have support for this, but unless there is demand for it, this is likely more clunky to manage in Home Assistant than the native app.

FAQ

Why don't my volume or speed values update? They always show 0.
Chances are you have a G1 device. The G1 devices do not have an inbuilt flow meter. To my knowledge there is no way to retrofit one within the linktap ecosystem.
https://www.link-tap.com/#!/faq/en/What-is-the-difference-between-the-G1S-and-G2S-water-timers

Why do my taps always water for 15 mins, rather than the value defined by the duration number entity?
This is likely due to a mapping issue with the integration. Each switch has an attribute called duration_entity. This should match the entity created for duration. If not, please lodge an issue.
There is also an attribute called Default Time. If the duration entity matches, and has been changed from the default, this should be set to false. If not, again please lodge an issue.
This can also occur if you have renamed entities, as it uses some fuzzy logic name matching in order to get the duration. If you have renamed entities in HA, delete the integration, change the names as desired in the Linktap app, and re-add the integration again.

I added a new taplinker or valvelinker to my gateway, and changed the names of them in the app. Why are they called TapLinker 1 and TapLinker 2 in Home Assistant?
There can be a slight delay of up to 30 moinutes between devices being renamed on the mobile app and those changes being sycned with the local API. You can reload the integration later and the name changes should get picked up. Note that this will create all new entities, so dont setup any automations etc until the name change has come in.

What do I do if i have more than 1 gateway?
If you have more than 1 gateway, ensure the local HTTP API is enabled on each one, and set them up separately via its IP address or hostname. The integration has been tested and is known to work with multiple gateways. There should be no limitation on how many gateways can be added, and in theory you should be able to add gateways that are connected to different linktap accounts, as long as they are directly accessible via HTTP.