# Restore virtual sensor state

**URL:** <https://forum.phoscon.de/t/restore-virtual-sensor-state/4828>\
**Category:** General\
**Created:** [April 20, 2024, 3:49pm UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828 "2024-04-20T15:49:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LinearPancakes](https://forum.phoscon.de/letter_avatar_proxy/v4/letter/l/96bed5/32.png) [@LinearPancakes](https://forum.phoscon.de/u/LinearPancakes)\
**Post date:** [April 20, 2024, 3:49pm UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828/1 "2024-04-20T15:49:43Z")

</div>

We’re using a number of virtual sensors. For example, we have CLIPGenericFlag sensors for lighting/heating away mode.

While we were away, we unfortunately had a power cut. It seems the sensors restored to their default value of false when that happened. Obviously not ideal for this use case - we only realised on our return.

Is this expected behaviour for virtual sensors or a bug/feature request? It would be great if virtual sensors restored their state on restart.

---

<div class="post-metadata">

**Author:** ![Mimiix](https://forum.phoscon.de/user_avatar/forum.phoscon.de/mimiix/32/10_2.png) [@Mimiix](https://forum.phoscon.de/u/Mimiix)\
**Post date:** [April 23, 2024, 6:42pm UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828/2 "2024-04-23T18:42:41Z")

</div>

[@de\_employees](https://forum.phoscon.de/groups/de_employees)

---

<div class="post-metadata">

**Author:** ![manup](https://forum.phoscon.de/user_avatar/forum.phoscon.de/manup/32/9_2.png) [@manup](https://forum.phoscon.de/u/manup)\
**Post date:** [April 24, 2024, 7:49am UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828/3 "2024-04-24T07:49:39Z")

</div>

Yes currently this is how it works when loading CLIP sensors, and since 2018 in particular for CLIPGenericFlag and CLIPGenericStatus sensors. Related commit: [c06a8b](https://github.com/dresden-elektronik/deconz-rest-plugin/commit/c06a8b5a5c7cb906c8a022407db43d4b01c036f9), before that all CLIP sensors didn’t restore state.

It is a interesting case in general not only CLIP sensors. We can’t / shouldn’t just change the way it loads on startup since this may break other setups that count on this. But we can add a new attribute for sensors to specify if it should restore the last known value on startup.

I need to think about this a bit more and talk to the other devs but it would be very useful in general also for DDF based sensors.

---

<div class="post-metadata">

**Author:** ![LinearPancakes](https://forum.phoscon.de/letter_avatar_proxy/v4/letter/l/96bed5/32.png) [@LinearPancakes](https://forum.phoscon.de/u/LinearPancakes)\
**Post date:** [April 24, 2024, 11:00am UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828/4 "2024-04-24T11:00:02Z")

</div>

Many thanks for clarifying @manup.

As per the comment in the code on that commit, it’d be interesting to know why those two CLIP sensor types are unique in this way. I’m not sure in what use case it would be beneficial to not restore values on startup. But there must be some.

Appreciate any further work on this area. In the meantime I might switch to using a different type of CLIP sensor, even if they don’t _feel_ as appropriate.

---

<div class="post-metadata">

**Author:** ![jan666](https://forum.phoscon.de/user_avatar/forum.phoscon.de/jan666/32/972_2.png) [@jan666](https://forum.phoscon.de/u/jan666)\
**Post date:** [April 25, 2024, 9:10am UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828/5 "2024-04-25T09:10:36Z")

</div>

> [@manup](#):
>
> I need to think about this a bit more and talk to the other devs but it would be very useful in general also for DDF based sensors.

Could this fix the “window sensor show open after deconz restart” issue?

---

<div class="post-metadata">

**Author:** ![LinearPancakes](https://forum.phoscon.de/letter_avatar_proxy/v4/letter/l/96bed5/32.png) [@LinearPancakes](https://forum.phoscon.de/u/LinearPancakes)\
**Post date:** [July 29, 2025, 5:23pm UTC](https://forum.phoscon.de/t/restore-virtual-sensor-state/4828/6 "2025-07-29T17:23:28Z")

</div>

Any update on this @manup? It would be problematic for the away mode CLIPGenericFlag to get reset on power cut, as all associated automations would stop.
