Blackymas / NSPanel_HA_Blueprint

This allows you to configure your complete NSPanel via Blueprint with UI and without changing anything in the code
1.43k stars 259 forks source link

Sleep mode switch removed in v4.0? #1060

Closed Plawasan closed 11 months ago

Plawasan commented 1 year ago

I've updated my panels to v4.0.0, now I don't see any way how to set sleep mode - has it been removed?

If so, what's the workaround, setting sleep time to 0 to disable it and then setting it again to enable?

edwardtfn commented 1 year ago

The Sleep mode switch was replaced by "Timeout sleep", which will disable the sleep mode if time is set to 0s.

Plawasan commented 1 year ago

Fair enough however that's definitely a breaking change that should be explicitly mentioned in the release notes..

Unless there was a good reason to remove it, the sleep switch was a lot more intuitive solution than the new one.

Thanks!

geni0602 commented 1 year ago

the sleep switch was a better option for me. I have a panel in my bedroom and I am activating the sleep mode at night and deactivating it in the morning. It was pretty easy with a simple schedule. Now I have to look for a work around.

Still very good release.

thanks.

edwardtfn commented 1 year ago

that's definitely a breaking change that should be explicitly mentioned in the release notes..

You are totally right. I've missed that one. I've just edited the release notes adding this to the breaking changes.

Thanks a lot!

edwardtfn commented 1 year ago

the sleep switch was a better option for me. I have a panel in my bedroom and I am activating the sleep mode at night and deactivating it in the morning. It was pretty easy with a simple schedule. Now I have to look for a work around.

Ok. Thanks for the feedback. I can take a look in the possibility to return with that in a future release or maybe even as a customization, so you could use it now. I come back here when I have a better idea around this.

geni0602 commented 1 year ago

Thanks. I've just created for know a new automation with a service number.set_value and will reduce to 0 in the morning and put it back at 30 in the evening. This should also work

sejoki commented 1 year ago

I only had a day on 3.4 so maybe I'm imagining this, but didn't turning off sleep mode turn the display on in the previous version?

It'd be great if either setting the sleep timeout to 0 would wake the display up or even better, a separate button so it can be controlled with a motion sensor. I kind of like having all the information at a glance but the display really doesn't need to be on when I'm not in the room and having to touch it kind of defeats the purpose imo

edwardtfn commented 1 year ago

I only had a day on 3.4 so maybe I'm imagining this, but didn't turning off sleep mode turn the display on in the previous version?

That's right.

It'd be great if either setting the sleep timeout to 0 would wake the display

Yeah, this is a bug already fixed in dev, so it will be part of the next release.

or even better, a separate button so it can be controlled with a motion sensor.

There is a service for this: 😉

esphome.xxxxx_wake_up
data:
  reset_timer: false

This will wake-up if it is sleeping and reset the timers for dim and sleep. If you use reset_timer: true then it will also reset the page timer.

sejoki commented 1 year ago

There is a service for this: 😉

My bad, I clearly need to do a deep dive and familiarize myself a little more with the project.

T3mplate-wow commented 1 year ago

I also disable the panels in the evening and activate them in the morning. I believe I will find a workaround for this. But I also disable the panels while alarm is away or holiday. Because the system doesn’t know if I am away for 10hours or 20 days, a disable timer is not the best solution.

edwardtfn commented 1 year ago

If you set number.xxxxx_timeout_sleep to 65 you get the exactly same result as used to be turning on switch.xxxxx_sleep_mode and setting number.xxxxx_timeout_sleep to 0 have the exactly same result as turning off switch.xxxxx_sleep_mode. I can for sure come back with that switch, I just wanna understand if that is really needed as it will be inconsistent with other timeout settings or we will have 2 entities doing the same thing. As each entity cost some memory, which is the bottleneck now.

T3mplate-wow commented 1 year ago

This will work fine. Thanks for the explanation. May this possible configuration should be part of the documentation?

Plawasan commented 1 year ago

One thing I also noticed with the new setup - setting the dim brightness remotely doesn't seem to reset the timeout timers so when I reduce it from an automation for my living room panel in the evening, the panel never dims until you actually use it..

edwardtfn commented 1 year ago

Yeah, I'm aware of this and trying to find a fix. It's a bit hard to replicate all those cases, but I believe the one currently in dev have this specific case already fixed.

Do you have clear steps to reproduce this so I can make sure this one is covered?

Plawasan commented 1 year ago

Sure.. in the morning, I run this sequence against the panel:

action:
  - service: number.set_value
    data:
      value: "0"
    target:
      entity_id:
        - number.nspanel_livingroom_timeout_sleep
  - service: esphome.nspanel_livingroom_wake_up
    data:
      reset_timer: false
  - device_id: ffe8d5ba05dd7a2a7f55fb4be811ce03
    domain: number
    entity_id: number.nspanel_livingroom_display_brightness_dimdown
    type: set_value
    value: 50

and then in the evening, this follows:

  - device_id: ffe8d5ba05dd7a2a7f55fb4be811ce03
    domain: number
    entity_id: number.nspanel_livingroom_display_brightness_dimdown
    type: set_value
    value: 10

however.. since the panel is typically already idle and dimmed down, it will stay at 50% unless you actually use it, and only then will it go to 10% next time it's back to idle. If this is not fixed by what you're implementing, would calling the wake_up service at this point be a workaround?

for completeness, later at bedtime I also set the sleep time back to 60:

service: number.set_value
data:
  value: "60"
target:
  entity_id:
    - number.nspanel_livingroom_timeout_sleep
edwardtfn commented 1 year ago

Yeah, I believe this case is included in the fix.

samjw-nz commented 1 year ago

I would also like to see the switch return. Unless I'm missing something, there is no entity to see what the current sleep timeout is, so I can't set sleep to 0 if it's 60, or vise versa. My specific automation runs on the hour every hour, so I'd love to have it only run if sleep is or isn't enabled as it was in 3.4

Plawasan commented 1 year ago

I would also like to see the switch return. Unless I'm missing something, there is no entity to see what the current sleep timeout is, so I can't set sleep to 0 if it's 60, or vise versa. My specific automation runs on the hour every hour, so I'd love to have it only run if sleep is or isn't enabled as it was in 3.4

As much as I agree about the switch being more convenient, you can check the state of the number.panelname_timeout_sleep entity to see if it's enabled or not..

edwardtfn commented 1 year ago

You can check the state of entity number.xxxxx_timeout_sleep and when that is 0 is exactly the same as checking before for switch.xxxxx_sleep_mode disabled. And if the number is 65, it is the same as before the switch enabled.

It's important to understand that the switch was never showing if the panel was sleeping or not, that was only showing if the routine which will put the panel to sleep was enabled or not. Now you have the number. If that is 0, the sleep mode is disabled. For any other value, sleep mode is enabled. The difference is that now you have control on that time and can even use an automation to set the sleep time based on other conditions. If you want, share your automation here and I can modify in the way it will behave exactly the same with the current implementation.

By the way, if you want to know if the panel is currently sleeping or not is also much easier on this version, as you don't have to parse the json sensor anymore. You can just look for the state of sensor.xxxxx_cureent_page and if it is screensaver the panel is sleeping, otherwise it is awake.

samjw-nz commented 1 year ago

Oh brilliant, I was looking at device conditions where the switch used to exist. Hadn't thought to look for the state. Cheers

T3mplate-wow commented 1 year ago

As I read this I got very interested in which automation could need the sleep state. Do you have an example for me?

samjw-nz commented 1 year ago

All I have is an automation to put the screen to sleep between 10PM and 6AM. My NSPanel is in the bedroom, and I find that even on 1% brightness the screen is too bright to comfortably sleep at night.

pbranly commented 1 year ago

All I have is an automation to put the screen to sleep between 10PM and 6AM. My NSPanel is in the bedroom, and I find that even on 1% brightness the screen is too bright to comfortably sleep at night.

I fully agree. I would even say that between the full 100% value and the 1% dimmed one, I see a very small difference that does not justify this scale . But perhaps this is a nextion limitation Phil

edwardtfn commented 1 year ago

All I have is an automation to put the screen to sleep between 10PM and 6AM. My NSPanel is in the bedroom, and I find that even on 1% brightness the screen is too bright to comfortably sleep at night.

So, you enable sleep mode during the night and disable during the day, right?

Would beuseful to have control from your automation to select the page and brightness, so you can force the sleep from your automation?

edwardtfn commented 1 year ago

About this discussion on brightness, this biueprint is not really putting the device to sleep, but instead is showing a black screen with 0% brightness. Perhaps graying down the fonts combined with lower brightness will be sufficient to have the panel dark enough for someone to sleep in the room... It requires tests...

samjw-nz commented 1 year ago

All I have is an automation to put the screen to sleep between 10PM and 6AM. My NSPanel is in the bedroom, and I find that even on 1% brightness the screen is too bright to comfortably sleep at night.

So, you enable sleep mode during the night and disable during the day, right?

Would beuseful to have control from your automation to select the page and brightness, so you can force the sleep from your automation?

* no promises here. 😉

Correct, sleep mode (or black screen) at night until the schedule turns it back on. I think the issue was not so much what's present on-screen, but more the backlight glow that just comes from the screen being illuminated.

brian-kehoe commented 1 year ago

Just set up the NSPanel Blueprint and created an automation to active the wake_up command and change the timeout_sleep value based on motion sensor occupancy

alias: NSPanel - Motion Detected
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.office_motion_sensor_occupancy
    from: "off"
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.office_motion_sensor_occupancy
    from: "on"
    to: "off"
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.nspanel_current_page
            state: screensaver
        sequence:
          - service: esphome.nspanel_wake_up
            data:
              reset_timer: false
          - service: number.set_value
            data:
              value: "0"
            target:
              entity_id: number.nspanel_timeout_sleep
    default:
      - service: number.set_value
        data:
          value: "65"
        target:
          entity_id: number.nspanel_timeout_sleep
mode: single
edwardtfn commented 1 year ago

It's a bit hard to understand your yaml. If you use the "Add code <>" button it would be formatted in an easier to read mode. 😉

brian-kehoe commented 1 year ago

It's a bit hard to understand your yaml. If you use the "Add code <>" button it would be formatted in an easier to read mode. 😉

I did try that initially and it just inserted the yaml with ' at the beginning and the end 🤷

edwardtfn commented 1 year ago

Done! 🙂

edwardtfn commented 1 year ago

This might be of your interest: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/dev/docs/en/customization.md#sleep--wake-up-buttons

jayjayvm commented 1 year ago

Thank you Edward for your comment,

I am not looking for a timeout.... well it can be handy but not the same as sleep option. Sleep option was used in an automation, that when I goto bed a sensor notices that and will put the Panel to sleep, which means it goes completely dim, no background glow either for the panel does emit a lot of light when in time out, till now.

SO I fear that the new timeout option now available is just that fade the characters but leave the super glow on. Or I do not need a timeout for then every so many minutes my screen goes blank which I do not like for it has a function as clock and weather station in one. Would mean I have to walk to the panel ever so often and touch it to get the screen back.

So I do not fully see how a timeout option is the same or can replace the sleep option, in which case it would mean that I will not update the screen esp firmware any more.

Maybe I am wrong in this assumption, if so I love to hear this.

Again thank you.

edwardtfn commented 1 year ago

The Timeout Sleep does exactly the same as the switch sleep before. Please do not confuse with Timeout Dim, which won't turn off the display. If the dim is not going to 0 after the Timeout Sleep, then it is a bug. Could you please confirm that?

Also, the buttons I've shared above will force a sleep at the moment the button is pressed, which was not possible with the previous switch.

edwardtfn commented 1 year ago

So I do not fully see how a timeout option is the same or can replace the sleep option, in which case it would mean that I will not update the screen esp firmware any more.

I think this is a misunderstanding on how that switch worked before. Before, if you turn the switch on, the panel would enable the mode where it goes to sleep 65s without a touch and wake up with a touch. Now, if you set the Timeout Sleep to 65s, you will have exactly the same behavior (will go sleep after 65s and wake up with touch), the difference is that now you can change 65s to other time as you want. Also, before, if you turn off the switch Sleep mode, the panel will wake up if sleeping, and will never sleep again. This is exactly the same if you set the Timeout Sleep to 0s. If you wanna force your panel to sleep immediately, from an automation, was not possible before, but now you can just call a service to jump to page "screensaver", or create a button as I've recommended before, or simply set the Timeout Sleep to 1s. This was not possible before. Everything else that was possible, still possible.

edwardtfn commented 1 year ago

SO I fear that the new timeout option now available is just that fade the characters but leave the super glow on. Or I do not need a timeout for then every so many minutes my screen goes blank which I do not like for it has a function as clock and weather station in one. Would mean I have to walk to the panel ever so often and touch it to get the screen back.

This example from @brian-kehoe will do exactly what you are describing: https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/1060#issuecomment-1743755084

jayjayvm commented 1 year ago

I give it a try, thank you. Only hope I can make a roll back too if it is not to my liking.

edwardtfn commented 1 year ago

Roll back is possible. Just let me know and I will help with that, but I really want to insist with v4.0.2 as that have all the same possibilities available in v3.4 and much more. 😉

Freddyjb67 commented 1 year ago

Biztos.. reggel ezt a sorozatot futtatom a panelen:

action:
  - service: number.set_value
    data:
      value: "0"
    target:
      entity_id:
        - number.nspanel_livingroom_timeout_sleep
  - service: esphome.nspanel_livingroom_wake_up
    data:
      reset_timer: false
  - device_id: ffe8d5ba05dd7a2a7f55fb4be811ce03
    domain: number
    entity_id: number.nspanel_livingroom_display_brightness_dimdown
    type: set_value
    value: 50

Este pedig ez következik:

  - device_id: ffe8d5ba05dd7a2a7f55fb4be811ce03
    domain: number
    entity_id: number.nspanel_livingroom_display_brightness_dimdown
    type: set_value
    value: 10

azonban.. Mivel a panel általában már tétlen és tompított, 50% -on marad, hacsak nem használja ténylegesen, és csak akkor megy 10% -ra, amikor legközelebb üresjáratba kerül. Ha ezt nem oldja meg az, amit megvalósít, akkor a wake_up szolgáltatás hívása ezen a ponton áthidaló megoldás lenne?

A teljesség kedvéért később lefekvéskor az alvási időt is visszaállítottam 60-ra:

service: number.set_value
data:
  value: "60"
target:
  entity_id:
    - number.nspanel_livingroom_timeout_sleep

Hi! I noticed that "timeout sleep" the backlight does random turn off or not. This will ok after a restart solution?

jshep321 commented 1 year ago

FYI, the simple node red version below. Just pass a number as msg.payload.

image
edwardtfn commented 1 year ago

This will be possible with v4.1: https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-Customization#set-display-as-a-light

All the other functionality from 4.0 would be the same.

image

Please let me know your thoughts.