iobroker.bosch-ebike
Version:
Adapter for Bosch eBike
139 lines (128 loc) • 5.49 kB
HTML
<html>
<head>
<!-- Load ioBroker scripts and styles-->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css" />
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css" />
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<!-- Load our own files -->
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="words.js"></script>
<script type="text/javascript">
// This will be called by the admin adapter when the settings page loads
function load(settings, onChange) {
// example: select elements with id=key and class=value and insert value
if (!settings) return;
$('.value').each(function () {
var $key = $(this);
var id = $key.attr('id');
if ($key.attr('type') === 'checkbox') {
// do not call onChange direct, because onChange could expect some arguments
$key.prop('checked', settings[id]).on('change', () => onChange());
} else {
// do not call onChange direct, because onChange could expect some arguments
$key
.val(settings[id])
.on('change', () => onChange())
.on('keyup', () => onChange());
}
});
onChange(false);
// reinitialize all the Materialize labels on the page if you are dynamically adding inputs:
if (M) M.updateTextFields();
}
// This will be called by the admin adapter when the user presses the save button
function save(callback) {
// example: select elements with class=value and build settings object
var obj = {};
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else if ($this.attr('type') === 'number') {
obj[$this.attr('id')] = parseFloat($this.val());
} else {
obj[$this.attr('id')] = $this.val();
}
});
callback(obj);
}
</script>
</head>
<body>
<div class="m adapter-container">
<div class="row">
<div class="col s12 m4 l2">
<img src="bosch-ebike.png" class="logo" />
</div>
</div>
<!-- Put your content here -->
<!-- For example columns with settings: -->
<div class="row">
<div class="col s6 input-field">
<input type="text" class="value" id="username" />
<label for="username" class="translate">App Email</label>
</div>
</div>
<div class="row">
<div class="col s6 input-field">
<input type="password" class="value" id="password" />
<label for="password" class="translate">App Password</label>
</div>
</div>
<div class="row">
<div class="col s6 input-field" id="captchaResponse">
1. Open the Url below and login with your account
<p></p>
2. Open Developer Console F12 or Option + Command + I
<p></p>
3. You see a failed redirect in the Console copy the onebikeapp-ios:// url
<p></p>
<img src="copyurl.png" style="width: 30rem" />
<p></p>
4. Paste the url in the input field below
<p></p>
<p></p>
<a
href="https://p9.authz.bosch.com/auth/realms/obc/protocol/openid-connect/auth?client_id=one-bike-app&code_challenge=dDp31yHNMAGZeMSXeoOK66WOZOtkZjqYzpdZnfbWZfQ&code_challenge_method=S256&kc_idp_hint=skid&nonce=5bkl6RxVoUl3yFKi0SqgORYowCT16PG6htILaP0ujhQ&prompt=login&redirect_uri=onebikeapp-ios%3A%2F%2Fcom.bosch.ebike.onebikeapp%2Foauth2redirect&response_type=code&scope=openid%20offline_access&state=DECUwcce3we_7TDOt9fiLumGwylUrrjaMyX2vfQM90k"
target="_blank"
style="color: red !important"
>SingleKey Login Url CLICK HERE</a
>
<p></p>
<input
type="text"
class="value"
id="captcha"
placeholder="onebikeapp-ios://com.bosch.ebike.onebikeapp/oauth2redirect?state=DECUwcce3we_7T....."
/>
<label for="captcha" class="translate">onebikeapp-ios Url</label>
</div>
</div>
<div class="row">
<div class="col s2 input-field">
<select id="type" class="value">
<option value="flow">eBike flow</option>
<option value="connect">eBike Connect</option>
</select>
<label for="type" class="translate">Brand</label>
</div>
</div>
<div class="row">
<div class="col s2 input-field">
<input type="number" class="value" id="interval" />
<label for="interval" class="translate">Update interval (in minutes)"</label>
</div>
</div>
<div class="row">
<div class="col s2 input-field">
<input type="number" class="value" id="maxTrips" />
<label for="maxTrips" class="translate">Max fetched trips"</label>
</div>
</div>
</div>
</body>
</html>