I just started my HA journey which includes setting up a Fire Tablet w/Fully Kiosk as my control panel. This thread has been very helpful, thank you! I want to share some of my learnings and setup as well.
I noticed the beginning OP uses sensor/platform rest. This calls the Rest API for those sensors but if you also want some binary sensors you have to setup a binary_sensor/platform rest and thus it seems a second API call is required. I saw in the HA docs you can use the Restful rest platform (top level) and place all the sensors under one call. Here is my full setup with some special features like % memory free, statuses, app restart time, etc:
# Load Tablet Sensor Info via API Call
- resource: !secret ha_tablet_rest
scan_interval: 20
binary_sensor:
- name: Living Room Tablet Kiosk Mode
unique_id: homtab_kiosk_mode
value_template: '{{ value_json.kioskMode }}'
- name: Living Room Tablet Plugged In
unique_id: homtab_plugged_in
device_class: battery_charging
value_template: '{{ value_json.isPlugged }}'
- name: Living Room Tablet Screen Locked
unique_id: homtab_screen_locked
device_class: lock
value_template: '{{ value_json.screenLocked }}'
- name: Living Room Tablet Screen On
unique_id: homtab_screen_on
value_template: '{{ value_json.screenOn }}'
- name: Living Room Tablet Screen Saver On
unique_id: hometab_screen_saver_on
value_template: '{{ value_json.isInScreensaver }}'
- name: Living Room Tablet Kiosk Locked
unique_id: hometab_kiosk_locked
device_class: lock
value_template: '{{ value_json.kioskLocked }}'
- name: Living Room Tablet MQTT Connected
unique_id: hometab_mqtt_connected
device_class: connectivity
value_template: '{{ value_json.mqttConnected }}'
sensor:
- name: Living Room Tablet Motion Detector
unique_id: hometab_motion_detector
value_template: '{{ value_json.motionDetectorStatus }}'
- name: Living Room Tablet Current Tab
unique_id: hometab_current_tab
value_template: '{{ value_json.currentTabIndex }}'
- name: Living Room Tablet Last App Start
unique_id: hometab_last_app_start
device_class: timestamp
value_template: '{{strptime(value_json.lastAppStart+"-0500",
"%m/%d/%y %I:%M:%S %p%z",
"1/1/1900 00:00:00 AM")}}'
- name: Living Room Tablet Wifi Signal Strength
unique_id: hometab_wifi_signal_strength
device_class: signal_strength
value_template: '{{ value_json.wifiSignalLevel }}'
- name: Living Room Tablet Battery Level
unique_id: hometab_battery_level
device_class: battery
unit_of_measurement: '%'
value_template: '{{ value_json.batteryLevel }}'
- name: Living Room Tablet Battery Temperature
unique_id: hometab_battery_temperature
device_class: temperature
unit_of_measurement: '°C'
value_template: '{{ value_json.batteryTemperature }}'
- name: Living Room Tablet Storage Free Space
unique_id: hometab_storage_free_space
unit_of_measurement: '%'
json_attributes:
- internalStorageFreeSpace
- internalStorageTotalSpace
value_template: '{{(value_json.internalStorageFreeSpace /
value_json.internalStorageTotalSpace *100)|round(1)}}'
- name: Living Room Tablet RAM Free
unique_id: hometab_ram_free
unit_of_measurement: '%'
json_attributes:
- ramFreeMemory
- ramTotalMemory
value_template: '{{(value_json.ramFreeMemory /
value_json.ramTotalMemory * 100)|round(1) }}'
- name: Living Room Tablet App Free Memory
unique_id: hometab_app_free_memory
unit_of_measurement: '%'
json_attributes:
- appFreeMemory
- appTotalMemory
value_template: '{{(value_json.appFreeMemory /
value_json.appTotalMemory * 100)|round(1) }}'
This is included via a config file entry of:
rest: !include rest.yaml
I have Fully Kiosk Plus which has built in MQTT which I turned on. I quickly noticed the kiosk was pushing device info messages just like the Rest API provides, but a push vs a pull. So I decided to investigate switching to MQTT. I am glad I did, a couple of cool things:
- Seems a little easier to setup and manage (you can listen to MQTT topics to debug)
- Push vs pull model based on changes/events
- Really cool… I set an expire time for the MQTT connectivity sensor (mine is 60 seconds) so if there is no device info message sent in 60 seconds, then it shows the connection as unavailable. Soon as device is back online a message is sent and shown as available.
Here is the same set of sensors but setup via MQTT (some fields slightly changed):
# All MQTT Sensors
binary_sensor:
- name: HA Tablet Kiosk Mode
unique_id: tab_kiosk_mode
payload_on: true
payload_off: false
state_topic: living_room_tablet/deviceInfo
value_template: '{{ value_json.kioskMode }}'
- name: HA Tablet Plugged In
unique_id: tab_plugged_in
payload_on: true
payload_off: false
state_topic: living_room_tablet/deviceInfo
device_class: battery_charging
value_template: '{{ value_json.isPlugged }}'
- name: HA Tablet Screen Locked
unique_id: tab_screen_locked
payload_on: true
payload_off: false
state_topic: living_room_tablet/deviceInfo
device_class: lock
value_template: '{{ value_json.screenLocked }}'
- name: HA Tablet Screen On
unique_id: tab_screen_on
payload_on: true
payload_off: false
state_topic: living_room_tablet/deviceInfo
value_template: '{{ value_json.screenOn }}'
- name: HA Tablet Screen Saver On
unique_id: tab_screen_saver_on
payload_on: true
payload_off: false
state_topic: living_room_tablet/deviceInfo
value_template: '{{ value_json.isInScreensaver }}'
- name: HA Tablet Kiosk Locked
unique_id: tab_kiosk_locked
payload_on: true
payload_off: false
state_topic: living_room_tablet/deviceInfo
device_class: lock
value_template: '{{ value_json.kioskLocked }}'
- name: HA Tablet MQTT Connected
unique_id: tab_mqtt_connected
payload_on: true
payload_off: false
expire_after: 60
state_topic: living_room_tablet/deviceInfo
device_class: connectivity
value_template: '{{ value_json.mqttConnected }}'
sensor:
- name: HA Tablet Motion Detector
unique_id: tab_motion_detector
state_topic: living_room_tablet/deviceInfo
value_template: '{{ value_json.motionDetectorStatus }}'
- name: HA Tablet Current Tab
unique_id: tab_current_tab
state_topic: living_room_tablet/deviceInfo
value_template: >
{% if value_json.currentTabIndex == 0 %}
Home
{% elif value_json.currentTabIndex == 1 %}
Camera
{% elif value_json.currentTabIndex == 2 %}
Temps
{% else %}
'{{ value_json.currentTabIndex }}'
{% endif %}
- name: HA Tablet Last App Start
unique_id: etab_last_app_start
state_topic: living_room_tablet/deviceInfo
device_class: timestamp
value_template: '{{strptime(value_json.appStartTime+"-0500",
"%m/%d/%y %I:%M:%S %p%z",
"1/1/1900 00:00:00 AM")}}'
- name: HA Tablet Wifi Signal Strength
unique_id: tab_wifi_signal_strength
state_topic: living_room_tablet/deviceInfo
device_class: signal_strength
value_template: '{{ value_json.wifiSignalLevel }}'
- name: HA Tablet Battery Level
unique_id: tab_battery_level
state_topic: living_room_tablet/deviceInfo
device_class: battery
unit_of_measurement: '%'
value_template: '{{ value_json.batteryLevel }}'
- name: HA Tablet Battery Temperature
unique_id: tab_battery_temperature
state_topic: living_room_tablet/deviceInfo
device_class: temperature
unit_of_measurement: '°C'
value_template: '{{ value_json.batteryTemperature }}'
- name: HA Tablet Storage Free Space
unique_id: tab_storage_free_space
state_topic: living_room_tablet/deviceInfo
unit_of_measurement: '%'
value_template: '{{(value_json.internalStorageFreeSpace /
value_json.internalStorageTotalSpace *100)|round(1)}}'
- name: HA Tablet RAM Free
unique_id: tab_ram_free
state_topic: living_room_tablet/deviceInfo
unit_of_measurement: '%'
value_template: '{{(value_json.ramFreeMemory /
value_json.ramTotalMemory * 100)|round(1) }}'
- name: HA Tablet App Free Memory
unique_id: hometab_app_free_memory
state_topic: living_room_tablet/deviceInfo
unit_of_measurement: '%'
value_template: '{{(value_json.appFreeMemory /
value_json.appTotalMemory * 100)|round(1) }}'
Again pulled in via the config file:
mqtt: !include mqtt.yaml
Note: I converted the current tab index # to a label based on what tabs I have setup.
After trying both, I have removed the Rest version and sticking with MQTT.
I created this admin view dashboard for the tablet status:
Clicking on the camera card brings up a live feed of the camera - bonus!
Pretty fun integration.