question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example - More info

See original GitHub issue

In the last example on your wiki, your using input_number.nighttime to show sun-up/sun-down. Would you mind sharing the HA config for that input_number?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
michaelblightcommented, Jul 31, 2019

I think you could do it in HA along the lines of:

  trigger:
    platform: sun
    event: sunset
    offset: "-00:45:00"
  action:
    entity_id: input_number.nighttime
    service: input_number.set_value
    data:
      value: 1

And for sunrise:

  trigger:
    platform: sun
    event: sunrise
    offset: "-00:45:00"
  action:
    entity_id: input_number.nighttime
    service: input_number.set_value
    data:
      value: 0

Adjusting the offsets as you see fit.

1reaction
michaelblightcommented, Jul 31, 2019

I mainly use the Node Red add-on for automation in HA, so the field is just a simple input which NR then populates. So the HA config is:

input_number:
  nighttime:
    name: Night
    min: 0
    max: 1

And the NR flow is: Screen Shot 2019-07-31 at 5 57 29 pm

And it’s a NR add-on called node-red-node-suncalc that gives me sunrise and sunset. The NR code for the screen-shot above is:

[{"id":"400e2f26.d7bb9","type":"sunrise","z":"f6747993.c9b448","name":"","lat":"-37.813630","lon":"144.9977","start":"sunrise","end":"dusk","x":170,"y":1280,"wires":[["db67ec3.d54731"],[]]},{"id":"2cc91956.57b696","type":"api-call-service","z":"f6747993.c9b448","name":"Set","server":"9a5aae17.6700c","service_domain":"input_number","service":"set_value","data":"{\"entity_id\":\"input_number.nighttime\"}","mergecontext":"","output_location":"","output_location_type":"none","x":530,"y":1280,"wires":[[]]},{"id":"db67ec3.d54731","type":"change","z":"f6747993.c9b448","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t    \"data\": {\t        \"value\":\t            (payload = 1 ? 0 : 1)\t    }\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":1280,"wires":[["2cc91956.57b696"]]},{"id":"9a5aae17.6700c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

There’s probably a simpler way to do it in straight HA automation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

27 Best About Us & About Me Page Examples (+10 Templates)
Here are the best About Us and About Me examples and templates. ... Then, link to a page with more information.
Read more >
21 About Us Pages That Convert—Examples and Templates ...
1. The best About Us pages accomplish their goals through telling a story about a brand. Introduce the characters or setting, and establish...
Read more >
"Tell Me Something Interesting About Yourself" (With ... - Indeed
By having your responses ready for these types of questions, you can be a more confident candidate. In this article, we discuss why...
Read more >
How to Write a Perfect 'About Me' Page (With Examples)
You can use an "About Me" page to show prospective employers, clients, and colleagues what you do and what you've accomplished. Use images...
Read more >
Example Domain
This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found