:warning::warning::warning:Read the release notes before upgrading, in case there are BREAKING changes!:warning::warning::warning:
A Stromer bike that has "Mobile phone network" connectivity. This excludes the standard ST1 without the "Upgrade" (see Stromer Connectivity). ST2, ST3, ST5 and ST7 come standard with the required connectivity.
Configure this integration the usual way, before starting you will need to retrieve your
*) only if you already have this or require APIv3
For the API using a tool like MITM-proxy so you can intercept traffic between the app on your phone and the Stromer API.
Additional the setup flow will ask you for your username (i.e. e-mail address) and password for the Stromer API and the secrets retrieved through MITM-proxy.
In the current state it retrieves bike
, status
and position
from the API every 10 minutes.
There is an early implementation on toggling data on your bike, light
and lock
can be adjusted.
Do note that the switches do not immediately reflect the status (i.e. they will when you toggle them, but switch back quickly).
After your 'switch' command we do request an API update to check on the status, pending that update the switch might toggle back-n-forth some time.
The light-switch is called 'Light mode' as depending on your bike type it will switch on/off or between 'dim and bright'.
As with the switch
implementation a button
is added to reset your trip_data.
Multi-bike support (see #81 / #82 for details and progress). The config-flow will now detect if you have one or multiple bikes. If you have one, you can only select it (obviously). When multiple bikes are in the same account, repeat the 'add integration' for each bike, selecting the other bike(s) on each iteration.
Basically you'll have to trigger (through automations) the updates yourself. But it's the correct way to learn Home Assistant and the method shown below also saves some API calls to Stromer. Basically this will determine if the bike is unlocked and if so start frequent updates. The example will also show you how to add a button to immediately start the more frequent updates. And yes, I'm aware we can make blueprints of this, but I'll leave that for now until we have a broader user base and properly tested integration.
Create a switch
(i.e. input-boolean) named Stromer Frequent Updates
(i.e. becoming input_boolean.stromer_frequent_updates
. Feel free to name it otherwise, but this is what will be referred to below.
Create a new automation, click on the right-top three dots and select 'Edit as YAML'. Don't worry, most of it you will be able to use the visual editor for, it's just that pasting is much easier this way. Do note that you'll have to change the stromer
part of the bike (or after pasting, select the three dots, go back to visual editor and pick the correct entity).
alias: Stromer cancel updates when locked
description: ''
trigger:
- platform: state
entity_id: binary_sensor.stromer_bike_lock
to: 'on'
- platform: template
value_template: >-
{{ now().timestamp() - as_timestamp(states.sensor.stromer_last_status_push.state) > 600 }}
condition: []
action:
- service: homeassistant.turn_off
data: {}
target:
entity_id: input_boolean.stromer_frequent_updates
mode: single
alias: Stromer start updates when unlocked
description: ''
trigger:
- platform: state
entity_id: binary_sensor.stromer_bike_lock
to: 'off'
- platform: template
value_template: >-
{{ now().timestamp() - as_timestamp(states.sensor.stromer_last_status_push.state) > 600 }}
condition: []
action:
- service: homeassistant.turn_on
data: {}
target:
entity_id: input_boolean.stromer_frequent_updates
mode: single
alias: Stromer update sensors
description: ''
trigger:
- platform: time_pattern
seconds: /30
condition:
- condition: state
entity_id: input_boolean.stromer_frequent_updates
state: 'on'
action:
- service: homeassistant.update_entity
data: {}
target:
entity_id: sensor.stromer_speed
mode: single
button
-card, through view code editor
paste, switch back to visual editor and customize the below to your taste. Again pointing at speed but it will refresh if the bike is unlocked and trigger the updates helper.show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: homeassistant.update_entity
service_data: {}
target:
entity_id: sensor.stromer_speed
entity: ''
hold_action:
action: none
name: Start Stromer updates
icon: mdi:bike
show_state: false
Even though available does not mean it's stable yet, the HA part is solid but the class used to interact with the API is in need of improvement (e.g. better overall handling). This might also warrant having the class available as a module from pypi.
Integrations
page and use the three-dots icon on the top right to add a custom repository.Stromer
in Integrations
and install it!For each bike (i.e. api-user) you will have to add it as an integration. Do note that you first have to retrieve your client ID and Secret using some tool like mitmproxy to fetch these. If you don't know how to do this or what this implies; search from someone who can eloborate on this or do not use this integration. For more details and/or helpful users see the Dutch Stromer forum
Configuration
Integrations
+
button in the right lower cornerYou can adjust these in Configuration
, Integration
-> Entities
(e.g. https://{Your HA address}/config/entities
)
Just click on the device and adjust accordingly!
Please note that you can also click the cogwheel right top corner to rename all entities of a device at once.
I'm on Discord and used to frequent the Dutch Stromer forum more often, but feel free to add a Bug through the Issues tab on Github.
It works on my bike and Home Assistant installation :) Let me know if it works on yours!