ESPHome component and examples on GitHubgithub.com / TexhFexLabs / hydronode-esphome

A sensor and its secret

+ › Sensor › Own firmware gives a Sensor ID and a Secret, see Sensor and credentials. One sensor takes every value of one ESPHome node. Put both into secrets.yaml and never commit it.

secrets.yaml
hydronode_sensor_id: "550e8400-e29b-41d4-a716-446655440000"
hydronode_device_secret: "YOUR_HYDRONODE_DEVICE_SECRET"

Component, HTTP, time and the mapping

The signature contains the time, so http_request and an SNTP clock are required. Pin ref to a release tag so a build never changes underneath you.

YAML
external_components:
  - source:
      type: git
      url: https://github.com/TexhFexLabs/hydronode-esphome
      ref: v0.5.1
    components: [hydronode]

http_request:
  id: hydronode_http
  timeout: 10s
  verify_ssl: true

time:
  - platform: sntp
    id: hydronode_time
    timezone: UTC

hydronode:
  sensor_id: !secret hydronode_sensor_id
  device_secret: !secret hydronode_device_secret
  update_interval: 60s
  measurements:
    - source: air_temperature
      type: TEMPERATURE
    - source: air_humidity
      type: HUMIDITY
  commands:
    - name: pump
      type: BOOL

Every update_interval (at least 10 s) the component sends the latest value of each mapping, one signed request per value. type is a HydroNode type such as TEMPERATURE, see Sensor types; up to 25 per sensor.

Commands and switches with a real state

Declare the commands the device handles under commands: with name and type (BOOL, INT32, UINT32, INT64, UINT64, STRING). Unknown names are declined as No handler on the device, a wrong type as Type does not match. on_command gets command, value_json and type.

For a switch or a choice in HydroNode's Controls: declare the command (BOOL for on or off, UINT32 for a choice, which sends the option's index), report the state the device really took as a measurement, and in HydroNode read that data point as on or off or as a choice with Send a command when it is set. The example choice-and-state.yaml in the repository is a heater mode and a pump set from HydroNode and reported back.

Battery, uploads, troubleshooting

The optional power: block reports the power source and battery thresholds, see Battery and power. ESPHome installs its own updates; HydroNode lists the board but does not update it over the air. If nothing arrives, open the device console: a rejected request shows its reason, a 401 is almost always the clock or the secret. A longer walk through is in the ESPHome post.

NextPython, JS, Go