REST API Sensor data unkown

I have a few UBIBOT sensors setup.

Using rest API:

sensor 1:
  - platform: rest
    scan_interval: 60
    resource: API URL
    name: Temperature_basement_ubibot
    value_template: '{{ (value_json.channel.last_values|from_json).field1.value|float }}'

Through the UBIBOT website you can set how often it gets the data from the various sensors, and how often it syncs the data from the sensor to the cloud. Right now it I have it set to get data from each sensor once an minute and upload the data once a minute.
In HA it only displays the data for a bit then it shows unknown, it keeps repeating this.

image

How can I get HA to be in sync with this? So it just shows the last value until a new one is available? I at first did not have a scan_interval setup, but just tried it to see if it would work.

Thanks.

Any Help? Thanks.

Ever figure this out? Iā€™m having a similar issueā€¦ I have 4 ubibot sensors, 1 with an external temp/humidity probe. I can list the 4 sensors temp, but the second I add the humidity sensor I start getting these ā€œunknownā€ statesā€¦ It will cycle through each sensor listing it as ā€œunknownā€ for about 20 seconds, then pull a temp. If I look at the sensors using a graph there are gapsā€¦ I donā€™t get itā€¦ if I remove the humidity sensor, they never go to ā€œunknownā€

1 Like

Donā€™t have ubibot sensor, but would adjusting the timeout of the rest sensor prevent the unknown state?
If the sensor is not ā€˜respondingā€™ for 20s, set timeout as 21?
The default is 10s, you may have to test to get the right number.

Yes I got it figured outā€¦
I do one API call that pulls in all my Ubibot sensors:

# UBIBOT API CALL
  - platform: rest
    scan_interval: 5
    resource: https://api.ubibot.io/channels?account_key=XXX
    name: Master UbiBot
    value_template: '{{ now() }}'
    json_attributes:
      - channels

Then I created template sensors for each of the fields in each channelā€¦

#Livingroom UBIBOT 
  - platform: template
    scan_interval: 5
    sensors:
      livingroom_temp:
        friendly_name: "Livingroom Temperature"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[0].last_values|from_json).field1.value|float }}'
        device_class: temperature
        unit_of_measurement: "Ā°C"
      livingroom_humidity:
        friendly_name: "Livingroom Humidity"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[0].last_values|from_json).field2.value|float }}'      
      livingroom_lux:
        friendly_name: "Livingroom Lux"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[0].last_values|from_json).field3.value|float }}'

#Basement UBIBOT      
  - platform: template
    scan_interval: 5
    sensors:
      basement_temp:
        friendly_name: "Basement Temperature"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[1].last_values|from_json).field1.value|float }}'
        device_class: temperature
        unit_of_measurement: "Ā°C"
      basement_humidity:
        friendly_name: "Basement Humidity"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[1].last_values|from_json).field2.value|float }}'      
      basement_lux:
        friendly_name: "Basement Lux"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[1].last_values|from_json).field3.value|float }}'      
      basement_temp_vent:
        friendly_name: "Basement Vent Temperature"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[1].last_values|from_json).field7.value|float }}'
        device_class: temperature
        unit_of_measurement: "Ā°C"  

#Outdoor Ubibot        
  - platform: template
    scan_interval: 5
    sensors:
      outdoor_temp:
        friendly_name: "Outdoor Temperature"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[2].last_values|from_json).field1.value|float }}'
        device_class: temperature
        unit_of_measurement: "Ā°C"
      outdoor_humidity:
        friendly_name: "Outdoor Humidity"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[2].last_values|from_json).field2.value|float }}'      
      outdoor_lux:
        friendly_name: "Outdoor Lux"
        value_template: '{{ (states.sensor.master_ubibot.attributes.channels[2].last_values|from_json).field6.value|float }}'

Note that once you create the master call, if you check in your Developer Tools and look at the data for it, it will list all your sensors, it will list all your channel IDs then based on the order they are in there you use channels[0] and up.

Sweet! Gonna give this a go today to see if it fixes my issue.

Canā€™t thank you enough man. I got everything working now. Seemed minor, but it was driving me insane seeing ā€œunknownā€ randomly throughout the day.

Glad it worked, it was the great support from this community that helped me get it figured out!!

It was driving me nuts too!