This is amazing, thanks so much!
Just a side note, the usage of mqtt over using the REST API in HA was due to future planning on moving my venv setup to a docker instance that way I don’t have to modify the bash scripts.
Maybe a silly question but why do you have two shell commands? dh and dh2?
2 servers running docker
@klogg do you mind sharing how you build your supervisor_updates sensor?
Would be interested! Thanks
There is a whole thread on this here so it is not my own work and there is a lot more there than I use. I suggest you take a look
#============
#=== Sensors
#============
sensor:
# Sensor to track available updates for supervisor & addons
- platform: command_line
name: Supervisor updates
command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"addons":[.data.addons[] | select(.version != .installed)]}'''
value_template: "{{ value_json.addons | length }}"
json_attributes:
- newest_version
- current_version
- addons
# Sensors to track updates to other core components (audio, dns and CLI)
- platform: command_line
name: Updater Audio
command: 'curl http://supervisor/audio/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
json_attributes:
- newest_version
- current_version
- platform: command_line
name: Updater DNS
command: 'curl http://supervisor/dns/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
json_attributes:
- newest_version
- current_version
- platform: command_line
name: Updater CLI
command: 'curl http://supervisor/cli/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
json_attributes:
- newest_version
- current_version
# Alternate updater sensor for core since binary_sensor.updater is very slow to recognize updates
- platform: command_line
name: Updater Core
command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
json_attributes:
- newest_version
- current_version
#===================
#=== Binary Sensors
#===================
binary_sensor:
- platform: template
sensors:
# True if there's an update available for supervisor
updater_supervisor:
friendly_name: 'Updater - Supervisor'
device_class: problem
entity_id:
- sensor.supervisor_updates
value_template: "{{ state_attr('sensor.supervisor_updates', 'current_version') != state_attr('sensor.supervisor_updates', 'newest_version') }}"
availability_template: "{{ (states('sensor.supervisor_updates') | int(-1)) > -1 }}"
# True if there's updates available for any HACS components
updater_hacs:
friendly_name: 'Updater - HACS'
device_class: problem
entity_id:
- sensor.hacs
value_template: "{{ states('sensor.hacs') | int > 0 }}"
# True if there's updates available for any addons
updater_addons:
friendly_name: 'Updater - Addons'
device_class: problem
entity_id:
- sensor.supervisor_updates
value_template: "{{ states('sensor.supervisor_updates') | int > 0 }}"
implementado, obrigado !
@klogg
Nice work.
Is it possible to strip the
pending update(s)
from the result or how can I translate it to my native language?
Thanks for sharing your work
It’s hard coded in the sensor I’m afraid, I didn’t put it there.
You could create a custom button to mimic the entity line and then configure it yourself.
Or even easier of course, a template sensor.
Okay I’ll try it with a template.
I’ve one other question and hope some one can help me to create a version sensor for synology DSM
I found the following from the command line:
more /etc.defaults/VERSION
Which results in:
majorversion="6"
minorversion="2"
productversion="6.2.3"
buildphase="GM"
buildnumber="25426"
smallfixnumber="0"
builddate="2020/05/12"
buildtime="06:20:24"
Which translates to:
DSM 6.2.3-25426 update 0
Does docker monitor include Glances and HA-dockermoon or they need to be installed separately?
How to install this docker-monitor?
@valvex Congrats. Looks good. Would you mind sharing your lovelace config. Especially for the Wall Tablet in the middle of the screen or the System in the upper left.
Hey, thanks!
The wall tablet is an Android tablet that runs the Fully Kiosk Browser.
I have enabled the mqtt service which provides several info every minute.
For example,
- platform: mqtt
name: 'Tablet Battery'
state_topic: 'fully/deviceInfo/my_device_ID'
device_class: battery
value_template: "{{ value_json.batteryLevel }}"
json_attributes_topic: 'fully/deviceInfo/my_device_ID'
unit_of_measurement: '%'
As for the action commands, Fully has a REST API which I can directly call with shell commands.
For example,
shell_command:
wake_tablet: 'curl -X GET "http://192.168.1.*/?cmd=screenOn&password=*****"'
Also, Fully provides a real time screenshot of the tablet’s screen which i have added as a camera.
camera:
- platform: generic
name: Tablet
still_image_url: http://192.168.1.**/?cmd=getScreenshot&password=****
Finally, that’s the lovelace card (using multiple-entity-row and paper-buttons-row custom cards)
type: entities
entities:
- entities:
- entity: switch.sf_tablet ### That's a sonoff running ESPHome that controls the tablet charger ###
name: Power
- entity: binary_sensor.tablet_screen
name: Screen
- entity: sensor.tablet_reloads
name: Reloads
- entity: sensor.tablet_touches
name: Touches
entity: sensor.tablet_battery
icon: 'mdi:tablet-android'
name: Wall Tablet
secondary_info:
entity: sensor.tablet_battery
name: 'Battery:'
show_state: false
type: 'custom:multiple-entity-row'
- buttons:
- icon: 'mdi:television'
name: Screenshot
tap_action:
action: more-info
entity: camera.tablet_2
- icon: 'mdi:monitor-screenshot'
name: Wake
tap_action:
action: call-service
confirmation:
text: Confirm
service: shell_command.wake_tablet
type: 'custom:paper-buttons-row'
- buttons:
- icon: 'mdi:restart'
name: Restart
tap_action:
action: call-service
confirmation:
text: Confirm
service: shell_command.restart_tablet
- icon: 'mdi:reload'
name: Reload
tap_action:
action: call-service
confirmation:
text: Confirm
service: shell_command.reload_tablet
type: 'custom:paper-buttons-row'
Now, for the system part.
I run homeassistant core in a python virtual environment on a Windows PC.
So for the system stats i use the openhardware monitor integration.
For info such as the network usage, the reboot and screenshot commands, i use this custom integration.
I won’t elaborate much, since these are mostly Windows specific, but If you read the docs, everyting is greatly explained.
Let me know for anything else.
Didn’t need to install anything else. You just need to give HA access to docker.sock.
Thanks for reply!
Does Docker Monitor have full Glances and HA-dockermon dockers combined together, which means I can play with Glances integration like on a seperate Glances docker? I plan to install Glances docker as well, but do not want to, if “Docker Minitor” has full Glances too.
I don’t think it has full glances. But I’m not sure…
The setup you are saying is exactly what I have. I have glances container separate but only to check the visual dashboard it provides. I haven’t tried integrating that one which would have more features.
Are you able to post your config.yaml for docker monitor as I’m trying to install and I get an error saying
Invalid config for [docker_monitor]: [hosts] is an invalid option for [docker_monitor]. Check: docker_monitor->docker_monitor->hosts. (See /config/configuration.yaml, line 128). Please check the docs at https://github.com/Sanderhuisman/docker_monitor
This is my config which I’ve basically copied and pasted so not sure why there is an error.
docker_monitor:
hosts:
- url: unix:///var/run/docker.sock
name: Docker
event: true
monitored_conditions:
- version
containers:
plex:
switch: False
sensors:
- status
- uptime
- cpu_percentage_usage
- memory_usage
- memory_percentage_usage
- network_total_up
- network_total_down
The three /// is intentional as I’ve copied that from my portainer config in the compose yaml as that seems to work.
Sure!! Here you go:
#################
## DOCKER MON ##
docker_monitor:
scan_interval: 10
events: true
url: unix://var/run/docker.sock
containers:
- hassio
- plex
- openvpn-as
- letsencrypt
- watchtower
- mosquitto
monitored_conditions:
- utilization_version
- container_status
- container_memory_usage
- container_memory_percentage_usage
- container_cpu_percentage_usage
- container_network_speed_down
- container_network_speed_up
And this is my docker compose:
version: "2"
services:
hassio:
image: homeassistant/home-assistant:stable
container_name: hassio
restart: unless-stopped
network_mode: host
volumes:
- /home/ee02217/docker/hassio:/config
- /var/run/docker.sock:/var/run/docker.sock
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Lisbon
Thanks so much, I think I have it working, does it expose the monitored conditions as a sensor or an entity that you add to a card?