Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pigeon clock in sensor #32

Open
pinkywafer opened this issue Aug 2, 2020 · 5 comments
Open

Create pigeon clock in sensor #32

pinkywafer opened this issue Aug 2, 2020 · 5 comments

Comments

@pinkywafer
Copy link
Owner

For training/fun flying
Try esp32, rdm6300 and RFID rings

@pinkywafer pinkywafer changed the title Create pigeoon clock in sensor Create pigeon clock in sensor Aug 3, 2020
@pinkywafer
Copy link
Owner Author

ok... here's the plan!
using hardware suggested above (initially at least!)
and Esphome firmware:
set up esp32 to expose 20 switches (optimistic mode) to Home Assistant
Each switch relates to 1 bird. (we have less than 20!)
The rfid sensor turns on the relevant switch, indicating that the bird has returned home.
The switch can only be turned off from home assistant.
use an input_boolean to trigger a release of all birds that have been set to off (ie they've been taken out)
write the name, release timedate, location and distance (if known) to a NEW DATABASE - create another database in the HA mariaDB for this
when the bird returns (turns off the switch by rfid tag), write the timedate to the database along with duration and a calculated avg speed.

@jcallaghan
Copy link

Really love the sound of this project with some fantastic insights to be captured here.

Just an idea for your release input_boolean, could you use a script and avoid needing to create the input_boolean and automation to go with it? Also, when the script/input_boolean for the release could update an input_datetime for each bird released?

One other idea, depending on how much you want to do the calculations in Home Assistant when the RFID triggers for the bird that has returned you could use calculate the time passed since the date released to calculate their flight time and store this in a number field which in turn you could use for average flight time.

@pinkywafer
Copy link
Owner Author

You're thinking along the same lines as me. At the moment, my current test code has an input Boolean for release. The automation is currently setting an input date time to the current time for each bird which has been turned off, and turns the input Boolean off after a short delay (makes it easy to color the button etc on the front end to show the release. The return automation (one each, triggered by return) is updating a return input date time.

I've got a little custom component based on one i found in the community forum which is able to write to the database. Sql sensors should be able to pull any of this that I want to see.

pinkywafer added a commit that referenced this issue Aug 15, 2020
@pinkywafer
Copy link
Owner Author

This is starting to come along on my development HA instance.
Using pigeon name as the unique identifier of each bird in the database is working well.
I only want to define a number of pigeons ie. pigeon1 to pigeon20 etc, then use an input_text for each one to name each bird. This will allow me to rotate rings etc as the birds change over time, and will mean that the configuration will not need to change.
There is an issue with the SQL sensor for my use case as it requires a static query. I want to be able to base a query for each bird using WHERE name='{{states("input_text.pigeon1_name")}} so I've done a quick edit to the sql component to allow a templated query instead. This should not cause any issues if I were to use any other sql sensors as a template with no templated elements will still render the same as a static query.

@pinkywafer
Copy link
Owner Author

Since HA should know the long/lat of the device where the release is triggered from, this could be used to calculate distance.
see https://www.movable-type.co.uk/scripts/latlong.html for formula to calculate distance via long/lat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants