Irrigation Hunter X-Core remote control using REM pin


I have a Hunter X-Core irrigation controller (8 zones) and I wanted to integrate it into homeassistant for better control.
I had planned to add a relay to open the valves and bypass the controller (turned off) but I found out that there is a pin exposed for remote control.
I found this project and I want to build it using ESPHome.

Can anybody point me to the right direction?
One idea is to import the ardruino files and write the YAML for custom switches.
I have almost none programming knowledge so there might be an easier way to accomplish what I want that I don’t know about.

Thank you!

Have a read of this and see if you can make sense of it:

1 Like

This is where I started!

My first problem is that the ardruino files have no class but only void.
So I started from here

but I think I need to start earlier!

I think I need to define a (or more) class.
The available functions are the following. I only need to operate through a switch HunterStop, HunterStart and HunterProgram. The rest is internal as I understand it.

void HunterStop(byte zone);

void HunterStart(byte zone, byte time);

void HunterProgram(byte num);

void HunterBitfield(vector <byte>& bits, byte pos, byte val, byte len);

void HunterWrite(vector<byte> buffer, bool extrabit);

void HunterLow(void);

void HunterHigh(void);

I have spent several hours with no result.
I don’t know anything about C++ so I will try to create custom switches in HomeAssistant.

Any idea how to import this API?

2 Commands
GET /api/start/zone/[ZONE-NUMBER]?time=[TIME-MINUTES]&result=[WEBHOOK]
GET /api/stop/zone/[ZONE-NUMBER]?result=[WEBHOOK]

Don’t use ESPHome for this HTTP: GET function.
Use Home Assistant rest_command: instead.
This goes in your configuration.yaml file.

    url:'http://{{ target }}/api/start/zone/{{ zone_number}}?time={{ time_minutes }}&result={{ webhook }}
    method: 'GET'
    content_type: 'text/plain'
    url:'http://{{ target }}/api/stop/zone/{{ zone_number}}&result={{ webhook }}
    method: 'GET'
    content_type: 'text/plain'

Then you can use the service: item in your automations as

    service: rest_command.start_irrigation

You’ll need to use a service_template definition to pass the values for target , zone_number , and webhook.

  - service_template: rest_command.start_irrigation
  - data_template: 
    target: ""
    zone_number: "3"
    time_minutes: "8" 
    webhook:  "http://i_dont_know/something/something_else"
1 Like

Thank you very much for your time.
I successfully found a similar solution two nights ago.

  - platform: template
        friendly_name: "Irrigation On/Off"
            -  service: rest_command.startzone
            -  service: rest_command.stopzone
        icon_template: >-
               {% if is_state('switch.hunterirrigation', 'on') %}
               {% else %}
               {% endif %}

    url: "{{ states('input_select.zonenumber') }}?time={{states('input_number.zone_' ~ states('input_select.zonenumber') ~ '_timer')}}"
    url: "{{ states('input_select.zonenumber') }}"

And I use 2 helpers
input_select.zonenumber = Dropdown menu to select specific zone to water
input_number.zone_1 - 6_timer = Where I have 6 sliders to select time for each zone.

I think your approach is more clever but didn’t know how to send data through your service.


Anyway, it’s working and I learned some things about templates for next time :slight_smile:

My only problem with the above is the icon change because it errors with

Template loop detected while processing event:

I think I could either set a variable or add the change of the icon in the Automation I have set to “turn off” the irrigation only in HomeAssistant like a timer (as the interaction with the hunter controller is one-way).

- id: '1626945764401'
  alias: Irrigation timer
  description: ''
  - platform: state
    entity_id: switch.hunterirrigation
    from: 'off'
    to: 'on'
  condition: []
  - delay:
      hours: 0
      minutes: '{{ states(''input_number.zone_'' ~ states(''input_select.zonenumber'')
        ~ ''_timer'') | int }}'
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
      entity_id: switch.hunterirrigation
  mode: single