# Copyright (c) 2021 Hombrelab <me@hombrelab.com>

import voluptuous as vol
from homeassistant.helpers import config_validation as cv

DOMAIN = "watermeter"
UUID = "5247c6d0-4476-45ca-aba5-d5d0cc7043c2"

SW_MANUFACTURER = "Hombrelab"
SW_NAME = "Watermeter Reader"
SW_MODEL = "websocket"
SW_VERSION = "2.0.012"

TITLE = "Home"

SERVICE = "consume"

PULSED_NAME = "pulsed"
CONSUMED_NAME = "consumed"
DATETIME_NAME = "datetime"
TIMESTAMP_NAME = "timestamp"

# list of entities
ENTITIES = [
    [
        f'Watermeter {PULSED_NAME}',
        'mdi:water',
        'liter',
        PULSED_NAME,
    ],
    [
        f'Watermeter {CONSUMED_NAME}',
        'mdi:water',
        'm3',
        CONSUMED_NAME,
    ],
    [
        f'Watermeter {DATETIME_NAME}',
        'mdi:history',
        None,
        DATETIME_NAME,
    ],
    [
        f'Watermeter {TIMESTAMP_NAME}',
        'mdi:history',
        None,
        TIMESTAMP_NAME,
    ]
]

ENTITIES_SCHEMA = vol.Schema(
    {
        vol.Required(PULSED_NAME, default=1): int,
        vol.Required(CONSUMED_NAME): int,
        vol.Required(DATETIME_NAME): cv.string,
        vol.Required(TIMESTAMP_NAME): int,
    }
)

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
            {

            }
        )
    },
    extra=vol.ALLOW_EXTRA
)
