#At the time I was thinking user
1 messages Β· Page 1 of 1 (latest)
So, correct me if I'm wrong here, but you are trying to kinda setup something like modes (day time, night time, sleep, etc), right?
yeah
But, to answer your question, yes, you can create another date time helper (Settings > Devices & Services > Helpers > Create Helper > Date and/or Time.
But would I be able to chain the second helper to the first? Because that's how I made that one
Kinda? Ish. You could do it with an automation where if the helper changes, set the time to time + 1 min. Then you don't need a second one.
But, it'd be a lot easier to help if you were to explain what you are trying to do. 
the short of it is indeed a day/night cycle using a temp slider and time stamp that I can reuse for controlling air conditioner (in my house) and a small grow tent space heater (for my sister's house with tropical plants).
Already start making the time inputs and temp sliders, and doing a numeric offset for the temp slider to create fuzzy logic should be easy enough
https://cdn.discordapp.com/attachments/783043687532724244/1253086521150541854/SmartSelect_20240619_131716_Home_Assistant.png?ex=66749343&is=667341c3&hm=dae993dab6e7f31ea158b3d6ad29b83445b69c2148fe55522c2a1cc4c89bb98d& Template of the card I'm starting to make for it
In this pic I'd be starting to keep it 67 +/- say 3 degrees starting at midnight, but I also need to trigger -at- the time change to make sure if the temp was in the 'day mode' range but is now out of it that it fires off
I -guess- as long as I set one of the triggers to input_datetime it should still work?
I'm not that well versed on yaml yet, and the way HA approaches boolean logic and such is still making me scratch my head a bit. I'm more of an old-school programmer still
Ah, ok. Yeah, I think you're on the right approach since you want customization. And yes, you can set the trigger to an input_datetime and it should work fine. But, to add the minute, you could do something like this:
- platform: time
at: "{{ states('input_datetime.test_dt') + timedelta(minutes=1) }}"
So, if the input time is 07:00:00, it will trigger on 07:01:00.
ooooh
That looks nice if I'm following it right. I'm still working out in my brain how this is all going to go, need to pull out the whiteboard and draft some flowcharts
Thank you very much for the help! I'm feeling a bit proud that I've come this far for only using this stuff for a week and a half π
Hahaha... no problem. And yeah, you should feel proud! Let me know how it works out!
Will do! Part of the plan is that my sister wants to spread the word about this in the plant community, and I'm trying to put together a guide for others on hardware and scripting and stuff, and if I can make it as user friendly as possible, I'd like to. Sadly copy-paste scripts don't allow for entity replacement as easily as I might like (maybe with much more complex coding to make something more like an integration), but slowly gettting there
So, you'll want to look into blueprints eventually. They are exactly for that purpose. Plus, make sure you search the forums. There are a lot of posts about people automating greenhouses and other types of nurseries and such. LOTS of good info there for you to build on and contribute to as well.
Thanks a bunch!
Of course!
mode: single
trigger:
- platform: state
entity_id:
- input_datetime.day_mode_start
- input_datetime.night_mode_start
- sensor.multipurpose_sensor_temperature_measurement
condition: []
action: []Controller
``` Before I break by brain, this should start the trigger at both mode changes as well as whenever the sensor reports a temp change, right? (the sensors I'm using do it at 1C or every 15 min)
Yeah, you could do it that way... But, I'd do it this way:
- platform: state
entity_id:
- input_datetime.day_mode_start
- input_datetime.night_mode_start
from: "off"
to: "on"
- platform: state
entity_id:
- sensor.multipurpose_sensor_temperature_measurement
to: [something]
I suppose I could, just not sure what the functional difference would be. When does datetime turn 'off'?
Oh hell... you're 100% right. I threw those in thinking input_boolean and not input_datetime. Ignore me π
(Multitasking at it's worst lol)
it's okay, I could have missed something for all I knew
The other thing I'm tryning to figure out is adding two values, example input_number.day_temperature + input_number.ac_offset
Use a template for that: {{ (states('input_number.day_temperature') + states('input_number.ac_offset')) | int(0) }}
That could be spiffed up a bit to make it a little more robust, but that is a good starter.
Will int properly evaluate against the temp sensor's float value?
Didn't know it was a float... so, just change int(0) to float(0).
I just know the temp sensor is giving like 73.6, that's why I wanted to check.
Now if only I knew why trying to type into the 'value template' field in the gui keeps hanging the browser session
Hmmmm... try clearing your cache (or another browser).
heh, SIGSEGV in chrome is rarely good π
yeeeaaaahhhh you don't want those typically π
yeah, happening in chrome and firefox, both if I connect by IP or by my subdomain. Guess I'll have to mess with those in yaml
Either that or reboot your computer? If it's happening in both browsers, that's a bit odd.
I'll just keep an eye on it for now
description: ""
trigger:
- platform: state
entity_id:
- input_datetime.day_mode_start
- input_datetime.night_mode_start
- sensor.multipurpose_sensor_temperature_measurement
condition:
- condition: and
conditions:
- condition: time
after: input_datetime.day_mode_start
before: input_datetime.night_mode_start
- condition: numeric_state
entity_id: sensor.multipurpose_sensor_temperature_measurement
above: input_number.day_temperature
value_template: {{ (states('state.state') + states('input_number.ac_offset')) | float(0) }}
action: []
mode: single
```did I screw up or am I on the right track?
You don't need this: - condition: and. Conditions are and by default. Aside from that, it looks ok. What is this though? states('state.state')?
got it from the docs about numeric states ```condition:
condition: numeric_state
entity_id: sensor.temperature
above: 17
below: 25
If your sensor value needs to be adjusted
value_template: "{{ float(state.state) + 2 }}"```
Ah, that's just an example. You need to replace that with your actual sensor.
as for the and, part of the reason for that is because there's going to be an 'or' as well for testing against night time settings
but I want to get the daytime working before i mess with that
Just add the or blocks as you need to for your conditions. The engine will sus them out properly usually.
right, it's going to be (time AND temp) OR (nighttime AND nighttemp) when I'm done
Ohhhhh, ok. I see what you mean then.
and I think I see what you meant about making other templates.
entity_id: sensor.multipurpose_sensor_temperature_measurement
above: {{ (states('input_number.day_temperature') + states('input_number.ac_offset')) | float(0) }}```
is giving me this error: `Message malformed: expected float for dictionary value @ data['condition'][0]['conditions'][1]['above']`
Put it in quotes. "{{ (states('input_number.day_temperature') + states('input_number.ac_offset')) | float(0) }}"
oh, duh

description: ""
trigger:
- platform: state
entity_id:
- input_datetime.day_mode_start
- input_datetime.night_mode_start
- sensor.multipurpose_sensor_temperature_measurement
condition:
- condition: and
conditions:
- condition: time
after: input_datetime.day_mode_start
before: input_datetime.night_mode_start
- condition: numeric_state
entity_id: sensor.multipurpose_sensor_temperature_measurement
above: "{{ (states('input_number.day_temperature') + states('input_number.ac_offset')) | float(0) }}"
action: []
mode: single
``` Still giving the same error. I realized I don't think I actually want to be using value template because that appears to be adjusting the value of the multipurpose sensor's temperature
Huh... So, I tried it here and yeah, that's weird... BUT, even weirder is that my browser (FF) freaked out on it as well.
lmao. Eh, I'm laughing because... WHY?
So, yeah, I think that the above should either be a static or an input_number.
so I want another sensor to apply the offset, another helper, I think?
Yeah, looks like that might be the best way to approach it.
okay, I can do that
I was thinking you could leverage the value_template, but that wouldn't work for what you want to do.
I mean, I could in theory, but it would be adjusting in the opposite direction that is intuitive to the average user (i.e. raising the sensor's value up by the offset to make it appear hotter than it is)
it works and is more concise than this, but it's ugly.
Blueprint will probably allow me to address a lot of it when I get to that point, if only because ugliness can be hidden under the hood
Itβs not unheard of. A lot of sensors provide temp offsets for that purpose.
Yup. 100%.
I was a calibration specialist in my military youth. My brain is focused on 'offsets are used to show what the true value is', not that
so a bit of professional pride there π
lol true. But, Iβm just pointing out that people DO that thing. Right or wrong, itβs being done.
oh, totally
now off to #templates-archived to figure out how to add two numbers there >.<
for the record, template sensor with this value {{ states('input_number.day_temperature')|int(0) + states('input_number.ac_offset')|int(0) }}
Yup. I saw. Jorg is AWESOME.
who knows, maybe one day I'll actually be able to answer a question π
the rest of the automations should be cake walk now
https://dpaste.com/2PQN87TTK There's the 'finished' 'turn on the AC' script. Gonna test it out now
YES! As soon as I changed the day mode start time, it triggered the script and turned on the AC since it's a bit over temp
WOOT! Looks good! Congrats! Victory lap time!
indeed, now i need to replace the controller in my house because for some reason samsung is reporting 100x more usage on the energy grid than it's actually using
I saw you posting about that and I was gonna reply but then I was like "nah, they'll figure it out" π
I was trying to figure out what was making the error until I compared to my sister's house and saw the sensor reporting accurately, and considering all the issues I've already had with my coordinator at home not recognizing devices properly, well ... why shouldn't the biggest commercial tech company in South Korea not have a number off by two decimal places
I completely missed this. Duh.