Skip to content

Commit 0de2e68

Browse files
authored
Add pause/resume buttons to Portainer (#166028)
1 parent 21d06fd commit 0de2e68

File tree

4 files changed

+634
-0
lines changed

4 files changed

+634
-0
lines changed

homeassistant/components/portainer/button.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@ class PortainerButtonDescription(ButtonEntityDescription):
7474
)
7575
),
7676
),
77+
PortainerButtonDescription(
78+
key="pause",
79+
translation_key="pause_container",
80+
entity_category=EntityCategory.CONFIG,
81+
press_action=(
82+
lambda portainer, endpoint_id, container_id: portainer.pause_container(
83+
endpoint_id, container_id
84+
)
85+
),
86+
),
87+
PortainerButtonDescription(
88+
key="resume",
89+
translation_key="resume_container",
90+
entity_category=EntityCategory.CONFIG,
91+
press_action=(
92+
lambda portainer, endpoint_id, container_id: portainer.unpause_container(
93+
endpoint_id, container_id
94+
)
95+
),
96+
),
7797
)
7898

7999

homeassistant/components/portainer/icons.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"entity": {
3+
"button": {
4+
"pause_container": {
5+
"default": "mdi:pause-circle"
6+
},
7+
"resume_container": {
8+
"default": "mdi:play"
9+
}
10+
},
311
"sensor": {
412
"api_version": {
513
"default": "mdi:api"

homeassistant/components/portainer/strings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@
6666
"images_prune": {
6767
"name": "Prune unused images"
6868
},
69+
"pause_container": {
70+
"name": "Pause container"
71+
},
6972
"restart_container": {
7073
"name": "Restart container"
74+
},
75+
"resume_container": {
76+
"name": "Resume container"
7177
}
7278
},
7379
"sensor": {

0 commit comments

Comments
 (0)