pdwonline / youless

Home Assistant custom sensor for youless
2 stars 11 forks source link

Allow s0 Port to be used as Water Meter #6

Open Veldkornet opened 3 years ago

Veldkornet commented 3 years ago

I use the s0 port of the Youless as a water meter with a Cyble.

I checked with Youless that the readings are the same, it's just litres instead of watts.

Currently I've modified the sensor.py as below which works perfectly:

SENSOR_TYPES = {
    'pwr': ['Current Power usage', 'current_power_usage', 'W', 'hass:flash', 'energy.png'],
    'net': ['Net Power usage', 'net_power_meter', 'kWh', 'hass:gauge', 'electric-meter.png'],
    'p1': ['Power Meter Low', 'power_meter_low', 'kWh', 'hass:gauge', 'energy.png'],
    'p2': ['Power Meter High', 'power_meter_high', 'kWh', 'hass:gauge', 'energy.png'],
    'n1': ['Power Delivery Low', 'power_delivery_low', 'kWh', 'hass:gauge', 'energy.png'],
    'n2': ['Power Delivery High', 'power_delivery_high', 'kWh', 'hass:gauge', 'energy.png'],
    'cs0': ['Water Meter', 'water_meter', 'm3', 'hass:gauge', 'energy.png'],
    'ps0': ['Current Water usage', 'current_water_usage', 'L/min', 'hass:water', 'water.png'],
    'gas': ['Gas consumption', 'gas_meter', 'm3', 'hass:gas-cylinder', 'electric-meter.png']
}

However I guess this will break once it becomes a native HA integration (FYI @cjong). Hence I'm proposing to add an option in the config as to whether the the s0 is default or used as the water meter.