Then you will have to define an arbitrary and literal custom trigger for your case
Or you can look at installing adaptive lighting to help with this.
All of this complexity, and I just need it to something different between two times.
When it comes to this platform, if you ask a vague or general question it is very likely you will receive responses with a variety of general methods that may accomplish what you have described. We don’t know anything about the structure, constraints, options, or needs of your automation or devices unless you share it…
We don’t know anything about the structure, constraints, options, or needs of your automation or devices unless you share it…
I was referring to HA having a half a dozen different ways to determine what is constituted as day\night, but not the obvious one of having a field that you fill in to tell it directly.
The problem that I’ve found with HA is that it’s exceedingly good at letting you create bespoke solutions that are tailored to your exact needs, but rather poor when it comes to simply giving you a button to press to do something.
Personally, I’d consider asking if something had a built in day\night cycle to be a pretty direct question that doesn’t have much nuance. The system might be simple or complex, it just needs to be a built in system that will return “Day” based on a series of variables, or “Night” based on another series of variable. What the variables are could be a follow up question.
Community Guide: Asking a Good Question
Ironically, I asked one of the big AI chat bots this, and it wrote me a template that returned day\night based on the time helper.
The bot gave me the best answer.
I have a feeling that AI capable of writing simple code may be a game changer for people like me who just want simple solutions to clearly defined problems.
Glad it worked. Don’t lean too hard on them, they have proven inaccurate with HA quite a few times already. Personally I would rather learn the system myself because then when I want to do something the AI can’t handle I know how - but to each their own and no judgement.
This is actually a very accurate and fair assessment of HA.
Though whether this is a good thing or a problem entirely depends on your individual situation and expectations.
I was more suggesting that the bots were better at answering my questions than the community, because the bots didn’t over complicate things.
For example, in this instance the bot gave me some code that had two outputs, day and night. Because my question had binary choice in it.]
it didn’t talk about variable light levels, or suggest that I might want to use light sensors. It just gave code that split the day into two sections.
I’m curious, what was the answer of AI?
I would create a boolean (on-off) and create a automation around that.
If time is 22:00 then turn boolean off, if time is 06:00 then turn boolean on.
Off = Night
On = Day
There is no need for all that.
You’ve already been given this very simple solution:
It can be set up via the UI, no need for YAML.
- Give it a name.
- Give it an on time.
- Give it an off time.
- Done.
You can then use the state of this binary sensor wherever you want, including in conditions.
A couple of observations, now that the original question has been answered several different ways.
First, I’m surprised AI gave the right answer here. I’d be curious to see it. For me, so far, AI has always confidently given a very simple and straightforward answer which looked ideal. But each time it was totally incorrect and unworkable. In AI terms, a pure hallucination.
Second, I’m impressed by the depth of the answers in this thread. In some other environments the OP would have gotten the direct and technically correct answer to the specific question: No. HA doesn’t have that exact option built in.
Instead, even without knowing the specific use case, a number of workable solutions were offered. HA is very flexible and you can make things as simple or as complex as you’d like. Most of us think of that as a benefit. But if all you want is a simple “set it and forget it” appliance which requires no tinkering, then there are better options for you.
In hindsight, the obvious answer
Create a time helper to store an AM and a PM time, create a temple that returns a pre defined text value based on whether or not you’re currently between the two times.
Then simply read it from the automation using conditions.
The bit that I appreciate the most is that rather than just suggesting what to do it actually generated the code for me. So that I could copy and paste it right in. It was fully commented, too.
I’d like it if more people would simply post code to this forum. I’ve had trouble before with armchair experts telling me to “read the manual” and making out that I was simply making a mistake somewhere in the code when something didn’t function as expected, and when I asked them if they could replicate the solution on their own systems they just linked to the manual again. Eventually it turned out that I was going going down the wrong path, and that the armchair experts hasn’t understood the error message any more than I had, and were leading me down the wrong path because they hadn’t even tried to replicate the problem on a system that they knew was properly set up.
Eventually someone came along who understood what the error was, and it took about 10 seconds to fix everything.
I’ve been on the HA forums almost daily for over 7 years now and I will say that in my experience that is very far from true. I would bet money that if you look in almost every thread someone will have posted some code (of course if that is the appropriate to the topic).
But (caveat) that might also depend on the way the question is being posed.
If you post the use case you are trying to achieve with the code that you tried that is giving the error and along with the error message if there is one the vast majority of the time you will get a great response and with corrected code.
If you post an error without any code you will most likely get a response of “post the code you tried that isn’t working and what do you expect it to do”.
If you post a general question on “how do I…” and no other context you are more likely to get a link to the documentation. This is not a Nabu Casa help desk (or an AI bot) that will do all of the work for you. we generally expect you to at least put in the initial work to try to figure it out on your own first. Then if it still doesn’t work and you post what you tried then most of the time you will get more specific help.
Remember, all of the help you get here is unpaid. So in effect we are all “armchair experts”. Tho some are more “experts” than others. An in fact it is exceedingly rare for any true “experts” to be on this forum ever at all since most Nabu Casa employees never come on here to provide any help at all.
The problem that I had was that I already had the code, but it was giving me an error message, and I wanted to correct it.
Nobody would even touch it, they just told me to “read the manual” and kept making these vague suggestions that ended up leading me in completely the wrong direction.
Eventually, maybe after a couple of weeks, someone turned up who actually understood what the error message meant and that the fix was very simple (I was trying to call what I thought was function using arguments from an automation, but it turned out to be a command that cannot be called using arguments).
If you post a general question on “how do I…” and no other context you are more likely to get a link to the documentation.
Yeah, please don’t do that.
One of the reasons why the open source community is seen as being so closed and elitist by non-coders is when people come to a forum like this they’ve usually already read the manual and not been able to solve their problem, and they ask generic questions because they’re not familiar enough with the system to ask a detailed technical question. So linking to the documentation is the equivalent of someone asking their couch how to become a better runner and being told “run faster”.
in effect we are all “armchair experts”
Sorry, I wasn’t clear, this is an idiom in my language. It means someone who talks about something as if they were an expert, but in truth they never get out of their chair to actually do it.
Like, someone posting a hundred comments telling people to “read the manual”, because they don’t have the knowledge to solve the problem themselves.
Anyway, 'I’m getting off topic.
The answer to my question seems to be that there is no day\night cycle in HA, but there are several ways to write your own.
So point us to the post you are referring to. If we agree with you, we will apologise for not helping as you hoped we would.
That sounds like a really bad idea.
How exactly would HA “create a button” to do literally every single thing that any user could possibly want to do?
The flexibility and power of the HA system is that it gives you the framework and ability to do complex things. But that comes at a cost.
I’ve said this many other times in this forum…
you can have “easy”, “cheap” or “powerful”.
Pick two. You can never have all three. And I think I need to remove the option of “easy and powerful” from the list. Those two things are almost inevitably mutually exclusive.
yeah, please don’t do that…
we are all more than willing to help you but you have to have done your due diligence first to try to figure it out on your own. HA is not (and no matter how much the noob users/devs want it to be never will be) a simple system. it will take quite a bit of research and figuring out.
you will need to put in the basic work up front and at least try.
If you provide zero context and seem to be asking for us to hold your hand from the start then you will get a link to the docs. If after being directed to the docs you reply that you have read the docs and specify what part of the docs you are having a problem with then at that point the real learning conversation can begin.
it’s possible that “the open source community” is seen as “elitist” is that maybe the new user expects too much from us to help them and expects too little of themselves to put in the minimum effort to either read the docs (which happens way more than you think and a lot of times those users actually haven’t read the docs so the link is totally appropriate) or at least to post a “help-us-to-help-you” type of question.
But to clarify that’s not what it sounds like you did in your request so I’m not addressing your particular situation. So don’t take my references to “you/your” above as literally meaning you. I’m just addressing the generic statement you made above.
why? posting a link can’t hurt. And it will free up this thread for discussions of the actual OP.
It wouldn’t that’s why it has a Automations and templates, as well as YAML support so that users can customise functions, and Blueprints so that they can share their customisations with others.
It’s one of HA’s strongest features.
You can never have all three.
Arguably, one of Open sources greatest weaknesses is that it often forgets number 4, approachability.
Quite a few potential users struggle to even get the software installed. This may seem a strange concept to you, but when you have a generation that was raised on one click installs from an app store the idea of having to install three other programs before they can even start installing the one that they actually want to use is off putting.
How many people using Tuya even know what Docker or Python are?
seem to be asking for us to hold your hand from the start
Yes, please do.
I’d like a glass of warm milk, and some cookies, too.
Is there a comment tag for "Hi, I’m new here, I don’t know my objects form my entities, but if you’re patient with me I’ll eventually get it, if not, I’ll but whatever Apple is selling that does half of what I want for twice the price.
maybe the new user expects too much from us
Like patience, or understanding?
I just had a simple question, does HA have a built in day\night cycle?
There isn’t really any more to it, or any deeper contextual meaning.
The answer was no.