bob1de / hass-apps

Some useful apps and snippets to empower Home Assistant and AppDaemon even more.
Apache License 2.0
85 stars 23 forks source link

[schedy] Can value accept input number? #54

Closed funroompc closed 3 years ago

funroompc commented 3 years ago

Hi there,

Thanks for the great product. I’m still learning how to use it and I appreciate the work spent on developing it.

I’m trying to see if I can link an input number from home assistant directly to the value in Schedy. This would be really great cos it would allow me to change the set points directly from home assistant.

I know I can use x instead, but allowing the ability to assign v to a variable would be something interesting!

Thanks

bob1de commented 3 years ago

Hi,

I know I can use x instead, but allowing the ability to assign v to a variable would be something interesting!

Hehe, that's like saying "Yes, I know I can transport this couch using a van which was constructed for that exact purpose, but doing it with a bicycle would be something interesting!" (And yes, it probably would. :))

But honestly, what's wrong with

- x: "float(state('input_number.foo') or 0)"

? Of course this assumes you want a numeric value with the default of 0 in case the entity wasn't found (which - at least some time ago - could happen during startup of HA).

IIRC something like this is shown in the Tips & Tricks section in the docs, in the example about dynamic start and end times.

Closing this as it's neither a bug nor a feature request. Feel free to keep commenting if something is still unclear.

Best regards Robert

funroompc commented 3 years ago

Thanks for the quick reply. I have just been using Schedy for a week now and I’m learning as I go along!

So the documentation has an example of a rule like this

Can I replace it with something like this?

If not, is there a more elegant way to do it?

I want to have 3 temperatures - home, away and sleep. Now as winter can get really cold, I would be dropping the temperatures as it progresses, hence the reason why I want a variable temperature set point!

Thanks!

bob1de commented 3 years ago

Thanks for the quick reply. I have just been using Schedy for a week now and I’m learning as I go along!

Great!

I really suggest to try it out yourself. The docs say that x can be used instead of v to generate values dynamically, so yes, it surely would work.

BTW, the tutorial also has an example for switching schedules based on an input_select, maybe you find that helpful for implementing your home/away/sleep modes.