#- platform: uptime
#- platform: moon
#- platform: season
- platform: time_date
  display_options:
    - "time"
    - "date"

# #----------------------------------------
# #
# #     lux
# #
# #----------------------------------------

# - platform: mqtt
#   state_topic: "sensor/lux"
#   name: "Luminosité"
#   device_class: illuminance
#   unit_of_measurement: "lx"
#   value_template: "{{ value | round(1) }}"
#   unique_id: luminosite_salon_01

# - platform: mqtt
#   state_topic: "arduino/garage/intensite"
#   name: "Intensité t_divisionnaire"
#   unit_of_measurement: "A"
#   device_class: current
#   value_template: "{{ value | round(1) }}"
#   unique_id: courant_t_div_01
# - platform: mqtt
#   state_topic: "arduino/garage/puissance"
#   name: "Puissance t_divisionnaire"
#   device_class: power
#   unit_of_measurement: "W"
#   value_template: "{{ value | round(1) }}"
#   unique_id: power_t_div_01

# #----------------------------------------
# #
# #     chauffage reglage PID
# #
# #----------------------------------------

# - platform: mqtt
#   state_topic: "sensor/chauff/pid/payload"
#   name: "payload"
# - platform: mqtt
#   state_topic: "sensor/chauff/pid/pv"
#   name: "pv"
#   value_template: "{{ value | round(3) }}"
# - platform: mqtt
#   state_topic: "sensor/chauff/pid/setpoint"
#   name: "setpoint"
# - platform: mqtt
#   state_topic: "sensor/chauff/pid/proportional"
#   name: "P"
#   value_template: "{{ value | round(3) }}"
# - platform: mqtt
#   state_topic: "sensor/chauff/pid/integral"
#   name: "I"
#   value_template: "{{ value | round(3) }}"
# - platform: mqtt
#   state_topic: "sensor/chauff/pid/derivative"
#   name: "D"
#   value_template: "{{ value | round(3) }}"

#----------------------------------------
#
#    stat divers: lumiere , detection
#
#----------------------------------------
# - platform: history_stats
#   name: Lampes couloir
#   entity_id: light.couloir
#   state: "on"
#   type: time
#   start: "{{ now().replace(hour=0, minute=0, second=0) }}"
#   end: "{{ now() }}"

# - platform: history_stats
#   name: Lampes escalier
#   entity_id: light.escalier
#   state: "on"
#   type: time
#   start: "{{ now().replace(hour=0, minute=0, second=0) }}"
#   end: "{{ now() }}"

# - platform: history_stats
#   name: Lampes cuisine
#   entity_id: light.plafond_cuisine
#   state: "on"
#   type: time
#   start: "{{ now().replace(hour=0, minute=0, second=0) }}"
#   end: "{{ now() }}"

# - platform: history_stats
#   name: Ouverture portes garages
#   entity_id: binary_sensor.porte_garage
#   state: "on"
#   type: count
#   start: "{{ now().replace(hour=0, minute=0, second=0) }}"
#   end: "{{ now() }}"

# - platform: history_stats
#   name: Ouverture portes escalier
#   entity_id: binary_sensor.porte_escalier
#   state: "on"
#   type: count
#   start: "{{ now().replace(hour=0, minute=0, second=0) }}"
#   end: "{{ now() }}"

#----------------------------------------
#
#    calcul humidité bien-etre
#sensor/tension/compteur
#----------------------------------------
- platform: mold_indicator
  indoor_temp_sensor: sensor.ecowitt_tempin
  indoor_humidity_sensor: sensor.ecowitt_humidityin
  outdoor_temp_sensor: sensor.ecowitt_temp
  calibration_factor: 2.0

#----------------------------------------
#
#    adresse IP internet
#
#----------------------------------------

#- platform: dnsip
#  name: ip_WAN

#- platform: seventeentrack
# username: gil.soulier@gmail.com
# password: Miss*17track
# show_archived: false
# show_delivered: true
- platform: sql
  db_url: mysql://homeassistant:homeassistant@core-mariadb/homeassistant?charset=utf8
  scan_interval: 60
  queries:
    - name: "MariaDB DataBase size"
      query: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1024, 1) "value" FROM information_schema.tables WHERE table_schema="homeassistant" GROUP BY table_schema;'
      column: "value"
      unit_of_measurement: MB

- platform: sql
  db_url: mysql://homeassistant:homeassistant@core-mariadb/homeassistant?charset=utf8mb4
  scan_interval: 3600
  queries:
    - name: db_size
      query: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1048576, 2) "value" FROM information_schema.tables WHERE #table_schema="homeassistant" GROUP BY table_schema;'
      column: "value"
      unit_of_measurement: MB
      device_class: data_size
# - platform: mqtt
#   state_topic: "domotic/ISAadapter/Package id 0"
#   name: "Temp PC Domotic"
#   device_class: temperature
#   unit_of_measurement: "°C"
#   value_template: "{{ value | round(1) }}"
#   unique_id: tempe_pc_domotic

