When I turn a light off through homey and then turn it on again, it remembers its old dim value.
But when I look at the light in homeyscript when it is OFF, its dim value is 0. Where is the old dim value stored? (and how to get to it in homeyscript?)
Guessing you are talking about either Z-Wave or ZigBee, that’s how they work.
Z-Wave: they have 0-99 for dim level (0 = off), and a seperate value to (255) to turn on the device in the old dim level, they don’t really have an “On/Off” capability.
ZigBee I’m not 100% sure how they work, but the way of working is the same.
So in short, it is saved in the device itself, and you can’t retrieve the value.
For the gear I use:
Ikea (zigbee) (Lamp Bank R) goes to 0% when turned Off
KaKu (CoCo) and Tuya wifi keep their dim level when turned Off
In Homeyscript, to retrieve the dim level for a device of which the dim level is 0% when off, the only way I think, is to first turn the light On, and then get its current dim level with a little delay.