I came across PaperSignals and was intrigued as I am looking for a child oriented countdown timer that can visually display time left before bedtime, getting ready for Kindergarden etc.
I wired up a Longrunner KY66 Servo zu an ESP8266 compiled without errors and uploaded the code but Google Assistant doesn’t communicate with my setup. Acording to some github issues this might be due to the fact that this only works in the US and I am in Germany? ¯_(ツ)_/¯
Anyways I really like the idea and was wondering if sometihing similar could be achieved with https://esphome.io/ and setting the countdown timer via an input in Home Assistant. The thing is I am just dabbing my toes into the Arduino/ESP World and have no clue, how to change the speed of my servo to move from 180 to 0 depending on the defined countdown time.
I would really appreciate if anybody could point me into the right direction of how to achieve this or suggest a different approach as to how to achieve the overall goal of creating an child oriented countdown timer.
Then cut and paste the servo example into your ESPHome and home assistant config.
Get the servo moving as you would expect with the -100 to 100 slider, then we can work on templates and automations for converting a timer to position.
When the timer is set for less than 60 minutes do you still want the timer to traverse the full range (but with bigger steps). Or say, do you want 30 minutes to start at half way and the step size of the wheel to always be constant no matter what the duration is set to?
Change your existing automation to use the position sensor instead of the original -100 to 100 input number:
- alias: Write Servo Value to ESP
trigger:
platform: state
entity_id: sensor.paper_signal_position #### <------ This has changed
action:
# Replace livingroom with the name you gave the ESP
- service: esphome.livingroom_control_servo
data_template:
level: '{{ trigger.to_state.state | int }}'
In the likely case that it does not work, let me know any errors you receive in the log and we’ll try to debug it. Don’t forget to do a config check before restarting / reloading.
“In the likely case that it does not work, let me know any errors you receive”
and my previous experiences of trial and error when tinkering with HA I am a little disappointed that your guide worked right out of the box and didn’t throw any errors WoW, just wow, you made my day! Thank you so much for walking me through this.
Alas I am still trying to wrap my head around the math of the two sensors:
{{ [ (states('input_number.paper_signal_time') | int - (as_timestamp(now()) - as_timestamp(states.input_boolean.paper_signal_timer.last_changed)) / 60) | round(0) ,0 ] | max }}
In this case the two points are (60, -100) and (0, 100).
So y = -3.3x + 100
This is made a little more complicated by the fact that 60 can actually be any number between 60 and 5 (the set duration input number) so I used a second linear equation to work out m for any timer duration between 60 and 5.