[External] Per-page duration?? #43
Replies: 7 comments 6 replies
-
I think this is a very good suggestion, but to do it, I think it would be interesting to redo the page-rotation loop. Currently, it's something that's called every X seconds, regardless if the service was called or not. I would love to change that, but with asyncio I'm not sure how to best implement it. I'd like to add a thread that's cancellable(because of the service) that would "sleep" for X amount of time (depending on the page's duration) before calling the next_page function. But again, I'm not sure how to best implement this in Python, mostly when asyncio exists. |
Beta Was this translation helpful? Give feedback.
-
I think it's a really good idea, but as you say, it's not easy to implement. |
Beta Was this translation helpful? Give feedback.
-
Just off the top of my head as I didn't try it out, but for the moment, would it be possible to mimic something like this using automation and several consecutive actions (pages) with service calls (send_message), using any of the loop functions in HA (ie. while: some_condition(s) sequence: service_calls)? |
Beta Was this translation helpful? Give feedback.
-
If I have understood this correctly, it should be possible without any problems... off the top of my head I would solve it so that the trigger is released with a helper when the trigger is released. i hope my bad english describes my thoughts |
Beta Was this translation helpful? Give feedback.
-
@Mrredstone5230 You could call automation itself, but you could also call it once (ie. at some specific time) and it can stay in that automation until loop condition is true. When it's false (state changes or again at some specific time in a day), you're getting out for automation. @gickowtf I'm also not a native english speaker, so no worries 😉 But you understood it correctly. |
Beta Was this translation helpful? Give feedback.
-
I did some testing and it's possible to achieve this via automation. |
Beta Was this translation helpful? Give feedback.
-
Well, I really like this approach. You see, my idea for the "enabled" tag came straight from automations themselves, and I even thought of implementing the "variables" tag for the integration. But I never actually thought it could fully be implemented automations. Here's a reimplementation I made with the "current logic" we use: alias: New Automation
mode: restart
description: ""
trigger:
- platform: homeassistant
event: start
enabled: true
condition: []
action:
- repeat:
while:
- condition: template
value_template: "{{true}}"
sequence:
- service: divoom_pixoo.show_message
metadata: {}
data:
page_data:
page_type: components
components:
- type: text
content: 1
position:
- 0
- 0
font: pico_8
color: white
target:
device_id: b90993533d7a83d58f252c3b58e171e0
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: divoom_pixoo.show_message
metadata: {}
data:
page_data:
page_type: components
components:
- type: text
content: 2
position:
- 0
- 0
font: pico_8
color: red
target:
device_id: b90993533d7a83d58f252c3b58e171e0
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0 Surprisingly, I really really like it. It made me think that maybe it could be possible to only support this method... This would allow the users to have more control on their own device, which is perfect! Also, this could clean up A LOT the current code we have (The sensor entity could be completely removed!) (Sure, services would have to be moved somewhere else, but that's doable !). (So just to be clear, I would be thinking of removing the "List of pages" in the config completely) I'm not sure what you think about this @gickowtf, but I think this would be a way better HA friendly implementation altogether. The logic would be handled by HA/The users, and really the only thing that would be lost is the easy notification system. (I've also seen multiple users that don't actually want to use the current "list of pages" system.) I'm not 100% certain with my idea, since this is a very big shift for the integration if actually implemented, but I just wanted to hear your thoughts about this. |
Beta Was this translation helpful? Give feedback.
-
From https://community.home-assistant.io/t/version-1-7-2-is-online-divoom-pixoo-64-integration/636885/29
Beta Was this translation helpful? Give feedback.
All reactions