#At the time I was thinking user

1 messages Β· Page 1 of 1 (latest)

fluid fog
#

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?

jade turret
#

yeah

fluid fog
#

But, to answer your question, yes, you can create another date time helper (Settings > Devices & Services > Helpers > Create Helper > Date and/or Time.

jade turret
#

But would I be able to chain the second helper to the first? Because that's how I made that one

fluid fog
#

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. ablobbouncefast

jade turret
#

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

fluid fog
#

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.

jade turret
#

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 πŸ˜›

fluid fog
#

Hahaha... no problem. And yeah, you should feel proud! Let me know how it works out!

jade turret
#

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

fluid fog
jade turret
#

Thanks a bunch!

fluid fog
#

Of course!

jade turret
#
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)
fluid fog
#

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]
jade turret
#

I suppose I could, just not sure what the functional difference would be. When does datetime turn 'off'?

fluid fog
#

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)

jade turret
#

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

fluid fog
#

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.

jade turret
#

Will int properly evaluate against the temp sensor's float value?

fluid fog
#

Didn't know it was a float... so, just change int(0) to float(0).

jade turret
#

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

fluid fog
#

Hmmmm... try clearing your cache (or another browser).

jade turret
#

heh, SIGSEGV in chrome is rarely good πŸ˜›

fluid fog
#

yeeeaaaahhhh you don't want those typically πŸ˜‰

jade turret
#

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

fluid fog
jade turret
#

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?
fluid fog
#

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')?

jade turret
#

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 }}"```

fluid fog
#

Ah, that's just an example. You need to replace that with your actual sensor.

jade turret
#

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

fluid fog
#

Just add the or blocks as you need to for your conditions. The engine will sus them out properly usually.

jade turret
#

right, it's going to be (time AND temp) OR (nighttime AND nighttemp) when I'm done

fluid fog
#

Ohhhhh, ok. I see what you mean then.

jade turret
#

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']`
fluid fog
#

Put it in quotes. "{{ (states('input_number.day_temperature') + states('input_number.ac_offset')) | float(0) }}"

jade turret
#

oh, duh

fluid fog
jade turret
#
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
fluid fog
#

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.

jade turret
#

I shouldn't be laughing, and yet ...

#

I can't believe I'm stuck on "A + B = C"

fluid fog
#

lmao. Eh, I'm laughing because... WHY?

#

So, yeah, I think that the above should either be a static or an input_number.

jade turret
#

so I want another sensor to apply the offset, another helper, I think?

fluid fog
#

Yeah, looks like that might be the best way to approach it.

jade turret
#

okay, I can do that

fluid fog
#

I was thinking you could leverage the value_template, but that wouldn't work for what you want to do.

jade turret
#

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

fluid fog
#

It’s not unheard of. A lot of sensors provide temp offsets for that purpose.

#

Yup. 100%.

jade turret
#

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 πŸ˜›

fluid fog
#

lol true. But, I’m just pointing out that people DO that thing. Right or wrong, it’s being done.

jade turret
#

oh, totally

#

for the record, template sensor with this value {{ states('input_number.day_temperature')|int(0) + states('input_number.ac_offset')|int(0) }}

fluid fog
#

Yup. I saw. Jorg is AWESOME.

jade turret
#

who knows, maybe one day I'll actually be able to answer a question πŸ˜›

#

the rest of the automations should be cake walk 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

fluid fog
#

WOOT! Looks good! Congrats! Victory lap time!

jade turret
#

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

fluid fog
#

I saw you posting about that and I was gonna reply but then I was like "nah, they'll figure it out" πŸ˜›

jade turret
#

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

fluid fog
#

I completely missed this. Duh.