Help needed with Template Sensor (JSON)

I am pulling information from Google Sheets using the RESTful integration, but I’m having issues extracting the right data out from the reply.

Let’s call my REST sensor sensor.googlesheets and it has a state of

{
   "range":"'Sheet'!B5:B8",
   "majorDimension":"ROWS",
   "values":[
      [
         "value1"
      ],
      [
         "value2"
      ],
      [
         "value3"
      ],
      [
         "value4"
      ]
   ]
}

I’m trying to extract the values value1/value2/value3/value4 to own template sensors, but I can’t get them right. What do I need to fix in my template sensor?

  - platform: template
    sensors:
      googlesheets_value1:
        icon_template: 'mdi-cash-multiple'
        value_template: >-
          {{ states.sensor.googlesheets.state["values"][0][0] }}

The template editor is your friend. Try:

value_template: "{{ (states('sensor.googlesheets')|from_json()).values.0.0 }}"

I complete forgot about the template editor. I tried it and had no issues with it. However, I can’t get the actual template sensor to work.

I have tried three different sensor types and all of them display “unavailable”.

  - platform: template
    sensors:
      googlesheets_stocks_cost:
        icon_template: 'mdi-cash-multiple'
        value_template: >-
          {{ states.sensor.googlesheets.state["values"][0][0] }}

  - platform: template
    sensors:
      googlesheets_stocks_value:
        icon_template: 'mdi-elevation-rise'
        value_template: >-
          {{ states.sensor.googlesheets["values"][0][1] }}

  - platform: template
    sensors:
      googlesheets_stocks_gainloss:
        icon_template: 'mdi-currency-eur'
        value_template: "{{ (states('sensor.googlesheets')|from_json).values.0.2 }}"

EDIT: Here are error messages related to those three templates:

* Could not render template googlesheets_stocks_cost: UndefinedError: 'str object' has no attribute 'values'
* Could not render template googlesheets_stocks_value: UndefinedError: 'homeassistant.helpers.template.TemplateState object' has no attribute 'values'
* Could not render template googlesheets_stocks_gainloss: UndefinedError: builtin_function_or_method object has no element 0

OK, that looks like the sensor.googlesheets output is being read as a string rather than as JSON.

What, exactly, is shown under Developer Tools / States for that sensor (copy/paste please)?

/developer-tools/state displays the following:
entity

sensor.googlesheets

state

{ "range": "'Sheet'!B5:B8", "majorDimension": "ROWS", "values": [ [ "value1" ], [ "value2" ], [ "value3" ], [ "value4" ] ] }

Looking at developer-tools/template, the following can be seen:

{{ (states('sensor.googlesheets')|from_json) }}
{'range': "'Sheet'!B5:B8", 'majorDimension': 'ROWS', 'values': [['value1'], ['value2'], ['value3'], ['value4']]}
{{ (states('sensor.googlesheets')|from_json).values }}
<built-in method values of dict object at 0x6890bdb0>
{{ (states('sensor.googlesheets')|from_json).values.0 }}
(output is blank)
{{ (states('sensor.googlesheets')|from_json).values.0.0 }}
Error rendering template: UndefinedError: builtin_function_or_method object has no element 0

I missed the (possibly unnecessary) brackets on from_json(), now edited above.

Just tried this and get the same results. This works though:

{{ (states('sensor.googlesheets')|from_json())['values'][0][0] }}

This is because “values” is a reserved keyword, as it is a function of a Python dictionary, so you can’t use dot notation in this case:

{{ (states('sensor.googlesheets')|from_json()).values()}} gives

dict_values(["'Sheet'!B5:B8", 'ROWS', [['value1'], ['value2'], ['value3'], ['value4']]])

In a similar way, keys is a reserved word:

{{ (states('sensor.googlesheets')|from_json()).keys()}} gives

dict_keys(['range', 'majorDimension', 'values'])

Thank you a lot for your help! I was completely lost with this template and had no idea why it wasn’t working. You saved my day :slight_smile:

Can you guys help me with another sensor with a similar situation,
Y get the following JSON via REST command and I can’t get the templating to work, the thing is that the JSON Is longer than the one I paste here, and I am currently selecting the value with the number it appears on the list as you can see in the template, the problem is that this JSON sometimes the value I want is the 5th sometimes it is the 7th and other times it is the 4th, so using the number to extract the sensor value via templating is not an option, is there any possibility to do it by “description” or something like that?

If I want for example to get the " description: Fw Build date" I would use this template for this example:

'{{ states.sensor.xxx_data.attributes.records[5]["formattedValue"] | float () }}'

.
which outputs the following value:

'20210830181758.0'

.

But if this FW Build date is then the 8th on the list, then it won’t work :s

Any idea how to template this based on the description name of the value?

Thanks!

JSON:

success: true
records: 
- idSite: 444444
  timestamp: 1636725259
  Device: Gateway
  instance: 0
  idDataAttribute: 641
  description: Bad non-unique identifier
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: o
  bitmask: 0
  formattedValue: xxxxxxxx
  id: 1
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 1
  description: gatewayID
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: d
  bitmask: 0
  formattedValue: OS
  dataAttributeEnumValues:
    - nameEnum: VGR, VGR2 or VER
      valueEnum: 0
    - nameEnum: OS
      valueEnum: 1
    - nameEnum: OS
      valueEnum: 2
    - nameEnum: LoRaWAN lopy
      valueEnum: 3
    - nameEnum: PHYSEE NodeMCU
      valueEnum: 4
  id: 2
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 386
  description: Productid
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: mi
  bitmask: 0
  formattedValue: xxxx
  id: 3
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 387
  description: MachineName
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: mn
  bitmask: 0
  formattedValue: MaMa

  id: 4
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 2
  description: Fw Version
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: v
  bitmask: 0
  formattedValue: v2.73
  id: 5
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 3
  description: Fw Build date
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: build
  bitmask: 0
  formattedValue: '20210830181758'
  id: 6
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 556
  description: Machine serial number
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: ms
  bitmask: 0
  formattedValue: HQXXXXX
  id: 7
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 453
  description: Capabilities
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: cp
  bitmask: 1
  formattedValue: many
  id: 8
- idSite: 444444
  timestamp: 1634301837
  Device: Gateway
  instance: 0
  idDataAttribute: 237
  description: Boot type
  formatWithUnit: '%s'
  dbusServiceType: null
  dbusPath: null
  code: w
  bitmask: 0
  formattedValue: Old kernel, or hw without boottype support, etc.
  dataAttributeEnumValues:
    - nameEnum: Tmp file already read, vrmlogger restarted!?
      valueEnum: '-3'
    - nameEnum: Reading tmp file failed
      valueEnum: '-2'
    - nameEnum: Reading watchdog register failed
      valueEnum: '-1'
    - nameEnum: Old kernel, or hw without boottype support, etc.
      valueEnum: 0
    - nameEnum: Cold boot or reboot
      valueEnum: 1
    - nameEnum: Unreproducable reset on CCGX
      valueEnum: 2
    - nameEnum: Reset button
      valueEnum: 3
    - nameEnum: Cold boot
      valueEnum: 4
    - nameEnum: Reboot command
      valueEnum: 5
    - nameEnum: Watchdog reboot
      valueEnum: 17
    - nameEnum: Max load avg exceeded (systems <= v2.06)
      valueEnum: 444444
    - nameEnum: Watchdog-ENOMEM
      valueEnum: 444444
    - nameEnum: Watchdog-EMAXLOAD (load average too high)
      valueEnum: 444444
  id: 9
- idSite: 444444
  timestamp: 1636292722
  Device: Gateway
  instance: 0
  idDataAttribute: 154
  description: Remote support
  formatWithUnit: '%s'
  dbusServiceType: settings
  dbusPath: /Settings/System/RemoteSupport
  code: rss
  bitmask: 0
  formattedValue: Disabled
  dataAttributeEnumValues:
    - nameEnum: Disabled
      valueEnum: 0
    - nameEnum: Enabled
      valueEnum: 1
  id: 10
- idSite: 444444
  timestamp: 1636689746
  Device: Gateway
  instance: 0
  idDataAttribute: 543
  description: Remote support IP and port
  formatWithUnit: '%s'
  dbusServiceType: settings
  dbusPath: /Settings/System/RemoteSupportIpAndPort
  code: rsIpPort
  bitmask: 0
  formattedValue: xx.yyy.zzz.xx;xxxxx
  id: 11




Something like this should work:

rest:
  - resource: YOUR_REST_URL
    sensor:
      - name: "FW build date"
        value_template: >-
          {% set il = value_json['records'] %}
          {% for i in il %}
            {% if i['description'] == 'Fw Build date' %}
              {{ i['formattedValue'] }}
            {% endif %}
          {% endfor %}

can you help me adapt it to a sensor like the following:
The rest request is not a simple rest, so I already have a sensor that is the rest itself, and the I template to build each sensor (I really need to sendup building like ten of them)

The sensor that gets the JSON itself is this one:

sensor.vrm_data

.
And I already have it working like this, but with the already mentioned issue,

So how can I convert your templating from the REST to a sensor value template for this above mentioned REST sensor.

sensor:
  - platform: template

    sensors:

      fw_build_date:
        friendly_name: "FW build date"
        icon_template: mdi:car-battery
        unit_of_measurement: "version"
        value_template: '{{ states.sensor.vrm_data.attributes.records[149]["formattedValue"][:-2] | float () }}'


this might work:

          {% set il = state_attr('sensor.vrm_data', 'records') %}
          {% for i in il %}
            {% if i['description'] == 'Fw Build date' %}
              {{ i['formattedValue'] }}
            {% endif %}
          {% endfor %}

The problem with description is that the I have some items with the same description.

I am trying with “instance” or with “iddataattribute” as follows:

          {% set il = state_attr('sensor.vrm_data', 'records') %}
          {% for i in il %}
            {% if i['instance'] == '26' %}.
              {{ i['formattedValue'] }}
            {% endif %}
          {% endfor %}

But the problem is that I get nothing, I feel like the number should be formatted differently.

Please put this in the template editor (Developer Tools / Template), and paste the result:

{{ state_attr('sensor.vrm_data', 'records') }}

Then explain which element you are trying to extract. Your original paste is formatted as YAML not JSON.

It is sensible info, I can’t past the entire JSON, way to long to review it,

I paste the following section, that I can review and XXX mark the sensible info

IDS change, so are not usable, but IdData Attribute is unique (I think so far) and Instance is not unique to a single device, it repeats across multiple devices,

Maybe match a IdDataAttribute, or
another option could be to match both, an Instance and the description of that instance, this would be the most precise method, to look for the formatted value of an instance and a description.

An instance (eg:temp sensor) has multiple descriptions (senso type, sensor offset, sensor value)

What I want to extract for example is the fridge temp (AS A FLOAT VALUE!!!) which is in the ID 178,
Prevously extracted via this which gives errors when the JSON suddenly includes new IDs or publishes them in different order:

sensor:
  - platform: template

    sensors:
      triaca_fridge_temp:
        friendly_name: "Temp. Nevera"
        icon_template: mdi:thermometer
        unit_of_measurement: "ºC"
        value_template: '{{ states.sensor.vrm_data.attributes.records[177]["formattedValue"][:-2] | float () }}'

[
  {
    "idSite": xxxxxxx,
    "timestamp": 1637003894,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 641,
    "description": "Bad non-unique identifier",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "o",
    "bitmask": 0,
    "formattedValue": "02xxxxxa",
    "id": 1
  },
  {
    "idSite": xxxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 1,
    "description": "gatewayID",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "d",
    "bitmask": 0,
    "formattedValue": "OS",
    "dataAttributeEnumValues": [
      {
        "nameEnum": "VGR, VGR2 or VER",
        "valueEnum": 0
      },
      {
        "nameEnum": "OS",
        "valueEnum": 1
      },
      {
        "nameEnum": "OS",
        "valueEnum": 2
      },
      {
        "nameEnum": "LoRaWAN lopy",
        "valueEnum": 3
      },
      {
        "nameEnum": "PHYSEE NodeMCU",
        "valueEnum": 4
      }
    ],
    "id": 2
  },
  {
    "idSite": xxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 386,
    "description": "Productid",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "mi",
    "bitmask": 0,
    "formattedValue": "xxxxx",
    "id": 3
  },
  {
    "idSite": xxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 387,
    "description": "MachineName",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "mn",
    "bitmask": 0,
    "formattedValue": "xx xxxx",
    "id": 4
  },
  {
    "idSite": xxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 2,
    "description": "Fw Version",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "v",
    "bitmask": 0,
    "formattedValue": "v2.73",
    "id": 5
  },
  {
    "idSite": xxxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 3,
    "description": "Fw Build date",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "build",
    "bitmask": 0,
    "formattedValue": "20210830181758",
    "id": 6
  },
  {
    "idSite": xxxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 556,
    "description": "Machine serial number",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "ms",
    "bitmask": 0,
    "formattedValue": "xxxxxx",
    "id": 7
  },
  {
    "idSite": xxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 453,
    "description": "Capabilities",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "cp",
    "bitmask": 1,
    "formattedValue": "xxxxxxxx",
    "dataAttributeEnumValues": [
      {
        "nameEnum": "MxxxxxPC",
        "valueEnum": 1
      },
      {
        "nameEnum": "xxxxxxmand",
        "valueEnum": 2
      },
      {
        "nameEnum": "Vxxxxion",
        "valueEnum": 4
      },
      {
        "nameEnum": "Vxxxxxnk",
        "valueEnum": 8
      }
    ],
    "id": 8
  },
  {
    "idSite": xxxxx,
    "timestamp": 1634301837,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 237,
    "description": "Boot type",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "w",
    "bitmask": 0,
    "formattedValue": "xxxxxx.",
    "dataAttributeEnumValues": [
      {
        "nameEnum": "Tmpxxxxx",
        "valueEnum": "-3"
      },
      {
        "nameEnum": "Rexxxxiled",
        "valueEnum": "-2"
      },
      {
        "nameEnum": "Reaxxxxxiled",
        "valueEnum": "-1"
      },
      {
        "nameEnum": "Old kexxxxort, etc.",
        "valueEnum": 0
      },
      {
        "nameEnum": "Cxxxxxxot",
        "valueEnum": 1
      },
      {
        "nameEnum": "UnrxxxxxxGX",
        "valueEnum": 2
      },
      {
        "nameEnum": "Reset button",
        "valueEnum": 3
      },
      {
        "nameEnum": "Cold boot",
        "valueEnum": 4
      },
      {
        "nameEnum": "Reboot command",
        "valueEnum": 5
      },
      {
        "nameEnum": "Watchdog reboot",
        "valueEnum": 17
      },
      {
        "nameEnum": "Maxxxxxxx2.06)",
        "valueEnum": 29997
      },
      {
        "nameEnum": "Watchdog-ENOMEM",
        "valueEnum": 30012
      },
      {
        "nameEnum": "Watchdog-EMAXLOAD (load average too high)",
        "valueEnum": 30253
      }
    ],
    "id": 9
  },
  {
    "idSite": xxxxxx,
    "timestamp": 1636292722,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 154,
    "description": "Remote support",
    "formatWithUnit": "%s",
    "dbusServiceType": "settings",
    "dbusPath": "/Settings/System/RemoteSupport",
    "code": "rss",
    "bitmask": 0,
    "formattedValue": "xxxxx",
    "dataAttributeEnumValues": [
      {
        "nameEnum": "xxxxx",
        "valueEnum": 0
      },
      {
        "nameEnum": "xxxxxx",
        "valueEnum": 1
      }
    ],
    "id": 10
  },
  {
    "idSite": xxxxxxx,
    "timestamp": 1636948947,
    "Device": "Gateway",
    "instance": 0,
    "idDataAttribute": 543,
    "description": "Remote support IP and port",
    "formatWithUnit": "%s",
    "dbusServiceType": "settings",
    "dbusPath": "/Settings/System/RemoteSupportIpAndPort",
    "code": "rsIpPort",
    "bitmask": 0,
    "formattedValue": "xx.x.xx.xx;xxxxxx",
    "id": 11
  },
 {
    "idSite": xxxxxx,
    "timestamp": 1636292722,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 637,
    "description": "Temperature custom name",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tscn",
    "bitmask": 0,
    "formattedValue": "Nevera Arcon",
    "id": 173
  },
  {
    "idSite": xxxxxxx,
    "timestamp": 1636292722,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 445,
    "description": "Product ID",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tsP",
    "bitmask": 0,
    "formattedValue": "xxxxx",
    "id": 174
  },
  {
    "idSite": xxxxxxx,
    "timestamp": 1636292722,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 447,
    "description": "Temperature scale factor",
    "formatWithUnit": "%.1F",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tsc",
    "bitmask": 0,
    "formattedValue": "1.0",
    "id": 175
  },
  {
    "idSite": xxxxxx,
    "timestamp": 1636292722,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 448,
    "description": "Temperature offset",
    "formatWithUnit": "%.0F",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tso",
    "bitmask": 0,
    "formattedValue": "8",
    "id": 176
  },
  {
    "idSite": xxxxxx,
    "timestamp": 1636292722,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 449,
    "description": "Temperature type",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tst",
    "bitmask": 0,
    "formattedValue": "Fridge",
    "dataAttributeEnumValues": [
      {
        "nameEnum": "Battery",
        "valueEnum": 0
      },
      {
        "nameEnum": "Fridge",
        "valueEnum": 1
      },
      {
        "nameEnum": "Generic",
        "valueEnum": 2
      }
    ],
    "id": 177
  },
  {
    "idSite": xxxxxxx,
    "timestamp": 1637004314,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 450,
    "description": "Temperature",
    "formatWithUnit": "%.1F °C",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tsT",
    "bitmask": 0,
    "formattedValue": "12.0 °C",
    "id": 178
  },
  {
    "idSite": xxxxxxx,
    "timestamp": 1637004314,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 451,
    "description": "Temperature status",
    "formatWithUnit": "%s",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tsS",
    "bitmask": 0,
    "formattedValue": "OK",
    "dataAttributeEnumValues": [
      {
        "nameEnum": "OK",
        "valueEnum": 0
      },
      {
        "nameEnum": "Disconnected",
        "valueEnum": 1
      },
      {
        "nameEnum": "Short circuited",
        "valueEnum": 2
      },
      {
        "nameEnum": "Reverse Polarity",
        "valueEnum": 3
      },
      {
        "nameEnum": "Unknown",
        "valueEnum": 4
      }
    ],
    "id": 179
  }
]

What is the idDataAtrribute of the value that you want? Does this stay the same regardless of the order of the JSON?

There are many that I want, but I can work around with one working to create the others

  • ID changes too much (around 30 times a day, fluctuates to another and then comes back to the original one)
  • Not sure about IdDataAttribute, I think it doesn’t change
  • instance + Device/description doesn’t change.

I want to get the Value 12.0 as a float value.

  {
    "idSite": xxxxxxx,
    "timestamp": 1637004314,
    "Device": "Temperature sensor",
    "instance": 26,
    "idDataAttribute": 450,
    "description": "Temperature",
    "formatWithUnit": "%.1F °C",
    "dbusServiceType": null,
    "dbusPath": null,
    "code": "tsT",
    "bitmask": 0,
    "formattedValue": "12.0 °C",
    "id": 178
  },
{% for result in il %}
  {% if result['instance'] == 26 and result['description'] == "Temperature" %}
    {{ result['formattedValue'].split(" ")[0]|float(-99) }}
  {% endif %}
{% endfor %}

This is what split returns, so you understanding what is happening:

[
  "12.0",
  "°C"
]
1 Like

Great! It works!
I see what you have done there!
can you point me towards some reading regarding “float(-99)”, I don’t get why you add a “-99” there.

Float (and other filters) now need to be provided with a default value which they will return if the value couldn’t be parsed, otherwise in the December(I think it is) Home Assistant update, the template will just fail to render at all.

By using this - you could do something like this:

{% set t = -99 %}
{% for result in il %}
  {% if result['instance'] == 26 and result['description'] == "Temperature" %}
    {% set t = result['formattedValue'].split(" ")[0]|float(-99) %}
  {% endif %}
{% endfor %}
{% if t > -99 %}
  {{ t }}
{% else %}
  Unavailable
{% endif %}

And if Unavailable is not ideal, then you could simply give the current state instead with

{{ states('sensor.triaca_fridge_temp')|float(0) }}

great!, thanks for the info!

Lets see if the JSON outputs properly, and behaves properly and I down have any drops during the night, then I’ll template other sensors!