sensor:
  - platform: mqtt
    name: plantas_salon_temperatura
    unit_of_measurement: "°C"
    force_update: true
    expire_after: 21600 # 6 hours
    state_topic: "home/OpenMQTTGateway/BTtoMQTT/C47C8D675AAC"
    value_template: '{% if value_json.tem %} {{ value_json.tem }} {% else %} {{ state.state }} {% endif %}'
  - platform: mqtt
    name: plantas_salon_bateria
    unit_of_measurement: '%'
    force_update: true 
    expire_after: 21600 # 6 hours
    state_topic: "home/OpenMQTTGateway/BTtoMQTT/C47C8D675AAC"  
    value_template: '{% if value_json.bat %} {{ value_json.bat }} {% else %} {{ state.state }} {% endif %}'
  - platform: mqtt
    name: plantas_salon_humedad
    unit_of_measurement: '%'
    force_update: true
    expire_after: 21600 # 6 hours
    state_topic: "home/OpenMQTTGateway/BTtoMQTT/C47C8D675AAC"
    value_template: '{% if value_json.moi %} {{ value_json.moi }} {% else %} {{ state.state }} {% endif %}'
  - platform: mqtt
    name: plantas_salon_luz
    unit_of_measurement: lux
    force_update: true
    expire_after: 21600 # 6 hours
    state_topic: "home/OpenMQTTGateway/BTtoMQTT/C47C8D675AAC"
    value_template: '{% if value_json.lux %} {{ value_json.lux }} {% else %} {{ state.state }} {% endif %}'
  - platform: mqtt
    name: plantas_salon_fertilizante
    unit_of_measurement: 'µS/cm'
    force_update: true
    expire_after: 21600 # 6 hours
    state_topic: "home/OpenMQTTGateway/BTtoMQTT/C47C8D675AAC"
    value_template: '{% if value_json.fer %} {{ value_json.fer }} {% else %} {{ state.state }} {% endif %}'
