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

Add window and light binary sensors #38

Merged
merged 4 commits into from
Sep 12, 2021
Merged

Conversation

DurgNomis-drol
Copy link
Owner

No description provided.

@github-actions
Copy link

github-actions bot commented Sep 8, 2021

🎉 HACS repository validator action summary 🎉
✅ The repository is not archived
✅ manifest.json file exist
✅ All required keys are present in manifest.json
✅ hacs.json has the 'name' key set
✅ The repository has a description
✅ toyota is added to https://github.com/home-assistant/brands NICE!
✅ The repository has topics
✅ The repository has issues enabled
✅ This day ends with an 'y' (Saturday)
✅ info.md exists
✅ Requirements validation
✅ Python wheels
✅ HACS load check

@renewoensdregt
Copy link
Contributor

Got error at initial restart. I had this previously too, so not likely related to this release, but maybe worth looking at. It resolves when removing the integration and install again (it´ll generate same sensors)

Logger: homeassistant.config_entries
Source: custom_components/toyota/init.py:57
Integration: Toyota Connected Services (documentation, issues)
First occurred: 09:10:46 (1 occurrences)
Last logged: 09:10:46

Error setting up entry renewoensdregt@hotmail.com for toyota
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 61, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 281, in handle_async_request
) = await self._pool.handle_async_request(
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
response = await connection.handle_async_request(
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 136, in handle_async_request
self.socket = await self._open_socket(timeout)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 163, in _open_socket
return await self._backend.open_tcp_stream(
File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 44, in open_tcp_stream
return await self.backend.open_tcp_stream(
File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 154, in open_tcp_stream
stream = await TLSStream.wrap(
File "/usr/local/lib/python3.9/contextlib.py", line 135, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc) from None
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/toyota/__init__.py", line 57, in async_setup_entry
    await client.login()
  File "/usr/local/lib/python3.9/site-packages/mytoyota/client.py", line 75, in login
    await self.api.get_new_token()
  File "/usr/local/lib/python3.9/site-packages/mytoyota/api.py", line 117, in get_new_token
    response = await client.post(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1825, in post
    return await self.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1494, in request
    response = await self.send(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1586, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1616, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1655, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1699, in _send_single_request
    ) = await transport.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 276, in handle_async_request
    (
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 78, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

Rest of install has gone fine and new sensors are generated. Will need to open the windows later today to see if all works as planned!

@DurgNomis-drol
Copy link
Owner Author

@renewoensdregt Can I get you to open a separate issue for the install problem? So I can track separately 😊

And great to hear!! Looking forward to an update

@renewoensdregt
Copy link
Contributor

renewoensdregt commented Sep 9, 2021

Unfortunately first test is not positive. Left front driver window open but sensors not updated.

from MyT:
36533090-B723-49C0-AC47-818539C9665F

from HA sensors:
96E583EF-920A-40A6-B46C-C2164F3A600E

I know you’re going to ask me to run the output as we’d been testing. But don’t have the PC nearby now. Will try later.

@renewoensdregt
Copy link
Contributor

Ignore!!! Likely takes some time to update!!!

E6360660-F5EF-496D-AF23-69672C638A67

i did notice it doesn’t update when driving and post driving between 5-10 minutes to update.

@DurgNomis-drol
Copy link
Owner Author

The integration has an update interval set at 5 minutes, this was because before it wasn't really necessary to update often, but this my change that. I will change it to 1 minute, but let us test it for a couple of days, just so we are sure it is not causing other problems

@renewoensdregt
Copy link
Contributor

Yes, let´s continue (I´ll likely do some more testing this weekend as I hardly use the car during the week), as I am not necessarily sure the issue is the timing of the polling of your module to the MyToyota, but it might even be MyToyota that doesn't poll the car very frequently. In that case increasing your polling won´t really help.

@DurgNomis-drol
Copy link
Owner Author

I just pushed an update to here that reduces the update interval to 90 seconds instead of 5 minutes.

@DurgNomis-drol
Copy link
Owner Author

Now you should also get 3 sensors, one for headlights(front), backlights and hazard lights 🎉

@DurgNomis-drol DurgNomis-drol changed the title Add window binary sensors Add window and light binary sensors Sep 9, 2021
@renewoensdregt
Copy link
Contributor

confirmed! new update pulls those in. Will do some further testing as said during the weekend!

@DurgNomis-drol DurgNomis-drol force-pushed the add-window-sensors branch 2 times, most recently from a64ed27 to 2f463c9 Compare September 10, 2021 19:58
@renewoensdregt
Copy link
Contributor

Been testing various combinations and all work well!!! The only thing I’ve noticed is that doors unlocked is not yet showing in your code and that it’s takes time for the updates to see, even in the MyT it takes time. Not sure how to test the lights…

@DurgNomis-drol
Copy link
Owner Author

I have not added doors yet. Taking one thing at a time. Will add them in a separate PR in the next couple of days 😊

If your hazard lights are turned on the sensor should show they are on and vice versa 😊

@renewoensdregt
Copy link
Contributor

renewoensdregt commented Sep 11, 2021

Tested hazards and works!! Light detected 😁

@DurgNomis-drol
Copy link
Owner Author

Awesome!!

I am also gonna introduce a overall warning sensor in the next PR along with the doors, hood and tailgate😄

AND i may have a surprise for you all. Being able to lock and unlock the car from HA, but i will need you guys to test it 🤞

@renewoensdregt
Copy link
Contributor

👏👏👏 did you see the PR for Dutch? Just asking as I’m not sure I did all right.

@DurgNomis-drol
Copy link
Owner Author

@renewoensdregt there is no PR open on here, did you open it on your own fork by accident? 🤔

@renewoensdregt
Copy link
Contributor

Told you I was no expert :-)
Link is here: https://github.com/renewoensdregt/ha_toyota/pull/1

but I’ll create a new one tomorrow if needed.

@DurgNomis-drol
Copy link
Owner Author

Haha that's totally okay, we all have to learn 😄

You need to open the PR against my repository like you did with the first one, or else i can't include it.

@renewoensdregt
Copy link
Contributor

renewoensdregt commented Sep 11, 2021

Let me try as indeed need to learn how to do it correctly. noticed you picked up the others quickly but this one not, hence why I wondered.

@DurgNomis-drol
Copy link
Owner Author

Github can have a steep learning curve when you start using it, it took me a couple of months before i got comfortable with it. So just take your time and ask (As you already do) and i will guide you as best as i can 😃

@DurgNomis-drol DurgNomis-drol merged commit 8463921 into master Sep 12, 2021
@DurgNomis-drol DurgNomis-drol deleted the add-window-sensors branch September 12, 2021 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants