ChrisHaPunkt / ha-stihl-imow

Using https://github.com/ChrisHaPunkt/stihl-imow-webapi to provide STIHL iMow lawn mower information to Home Assistant
19 stars 1 forks source link

configuration ? #1

Closed belidi closed 3 years ago

belidi commented 3 years ago

Hello, i also own the imow 422pc, i installed, via hacs, the component. But I don't really understand how and where to do the configuration. do we need to add something and where

ChrisHaPunkt commented 3 years ago

Hi belidi, as this an integration component, you need to add this integration to your HomeAssistant instance after installing via HACS.

I'm providing a ConfigFlow so after installing via HACS, you can just go to your "Configuration->Integrations" click the "Add Integration" button and look for STIHL iMow.

belidi commented 3 years ago

Thanks for the answer, but after installation and indicate user and password, I have: invalid authentication

ChrisHaPunkt commented 3 years ago

Hmm, okay. Are you providing your email address and your password which are working on https://app.imow.stihl.com/ ?

belidi commented 3 years ago

Yes, the same

ChrisHaPunkt commented 3 years ago

Can you see an error stack trace in your home assistant logs after trying to authenticate? If so, can you provide it in this issue?

ChrisHaPunkt commented 3 years ago

I just updated the component to provide more information on login failure via the logs. Please update the component and paste the corresponding log entry here, thanks.

belidi commented 3 years ago

Cette erreur provient d'une intégration personnalisée

Logger: custom_components.stihl_imow.config_flow Source: custom_components/stihl_imow/config_flow.py:51 Integration: STIHL iMow First occurred: 12:24:48 (1 occurrences) Last logged: 12:24:48

STIHL iMow did not return an access_token, check your credentials Traceback (most recent call last): File "/config/custom_components/stihl_imow/config_flow.py", line 51, in validate_input token, expire_time = await imow.get_token( File "/usr/local/lib/python3.8/site-packages/imow/api/init.py", line 116, in get_token await self.authenticate(self.api_email, self.api_password) File "/usr/local/lib/python3.8/site-packages/imow/api/init.py", line 159, in authenticate raise LoginError( imow.common.exceptions.LoginError: STIHL iMow did not return an access_token, check your credentials

ChrisHaPunkt commented 3 years ago

I just released a new version with a change how the password is provided to the authenticate api. Maybe your problem is related to special chars in your password.

ChrisHaPunkt commented 3 years ago

Please update your integration to version 0.1.0 and check if the error persists.

belidi commented 3 years ago

error persists ..... Cette erreur provient d'une intégration personnalisée

Logger: custom_components.stihl_imow.config_flow Source: custom_components/stihl_imow/config_flow.py:68 Integration: STIHL iMow First occurred: 9:19:53 (3 occurrences) Last logged: 10:15:26

Unexpected exception Traceback (most recent call last): File "/config/custom_components/stihl_imow/config_flow.py", line 111, in async_step_user self.data = await validate_input(self.hass, user_input) File "/config/custom_components/stihl_imow/config_flow.py", line 68, in validate_input del mowers_state["api"] KeyError: 'api'

ChrisHaPunkt commented 3 years ago

I identified another bug that keeps the integration from using the config flow. It's fixed in version 0.1.1. The occurrence of that bug states, that the authentication was successful with your credentials ;-)

belidi commented 3 years ago

Ok, it works I get the following information Battery Level, State, Total Blade (in sec.) thank you again for your work

ChrisHaPunkt commented 3 years ago

You're welcome. You have more information available in the attributes of the sensors. If I can spend more time, I'll provide more sensors with the information of the attributes itself aside the possibility to initiate an action to the mower.

jwmaas commented 3 years ago

Chris, may I reflect on the priorities? We can easily get to the attributes and create separate sensors by using NodeRed. So it would be very welcome if your time would go towards creating the relevant switches, rather than sensors.

For the 3 sensors containing attributes, I have loaded these into a "Current State" node in NodeRed, where I set "msg.payload" to "entity" which ensures all data are accessible. Then I use a "Change" node to select the attributes for the sensor. Then I use an "Entity" node to create the relevant HA sensor. Some data I convert to hours or kilometers using a "Function" node.

I have made a first cut overview for HA Lovelace, but still some work remains (formatting dates, map):

Screenshot 2021-06-27 at 16 05 53