Orvibo B25

That’s good enough for me, I just wasn’t sure if it was doable. As it seems like it might be I’m happy to wait and see what happens. I have plenty of other HA-related things to be getting on with in the meantime, but will be available to test things if required.

Thanks again for all your efforts.

Don’t know if this helps, but I had a look over the Amazon.co.uk’s reviews for the B25 and one (for the marsboy updated version - I don’t know what the updating involves) says they got it working on OpenHab as it appears as a Hue controllable device:

https://www.amazon.co.uk/review/RRUO0GNDXQA8J/

Might offer a different angle of attack or not.

(small amounts of) SUCCESS! I’ve got a script working that can intercept commands from the switch, read the state from them, and send its own commands to change the state.

Its very rough at the moment, and I’ve only tested it with one S20c (could be differences between the S20c and the B25, and differences between devices). Its going to take a bit of work to package it up into something usable, but I’ll probably be looking for people to help test it in the next few weeks

3 Likes

Happy to help test. I have 2x B25 (UK) units… Awesome work!

Thanks for your great work. I tried it today with a B25 EU, but I couldn’t get it working. It seems like the encryption method could not decode the messages. Here is the log.

@Philipp1001 thanks for trying! I’ve been meaning to put out a proper call for testers for the last few weeks, but life has gotten away from me.

Can you try installing the master version from the github repo (pip install git+https://github.com/insertjokehere/homemate-bridge) then run the bridge with an extra --packet-log-file /tmp/logfile.json. This will log all packets in and out to /tmp/logfile.json, I would appreciate it if you can send it to me

Okay, I runned it with the master version from github repository. Now there is a different message. Here is the content from the logfile.json. When I run it multiple times, sometimes the output in logfile.json just contains (with whitespace as last char) [{“keys”: {“112”:

@Philipp1001 can you try again with latest master? I forgot that the keys dict was bytestrings and needed to be base64’d as well.

The packet in the log decrypts OK as well now so it might get you a little further. When you were first trying were you using the version on PyPI?

logfile.json (about a minute running) and the command line output.
Yes I think I was trying the PyPI Versions. Also I installed sometimes with pip3 instead of pip, but in this master pip3 didn’t create a file in /usr/local/bin, so I installed with pip and corrected the shebang to python3. Hopefully there are no side effects.

I’ve pushed a new commit to master that should fix the ‘KeyError’ thing (dumb bug, really should write some tests for this thing), might get you a little further. I’ll cut a new PyPI version once I’ve got things working for you

YEAAAHH! Great step forward! CLI Output and logfile.json. Its on and off state is logged in terminal.

The switch appears in Home Assistant. But it don’t work with state and function, but thats maybe some of my other config problems? I activated mqtt in HA with “mqtt: discovery: true”. The homemate-bridge argument is “–mqtt-host localhost”. In HA is an entity called “switch.homemate_switch_19216818849”. Did I miss something in the MQTT-Protocol?

If you see the homemate_switch_ entity in HomeAssistant then your MQTT config is probably correct. I don’t see a 'cmd': 15 entry (state change) in the log.

Does toggling the switch from the HomeAssistant interface work? If you manually toggle the switch with the physical button does the HomeAssistant interface update?

I can confirm that this code is working with an Orvibo B25 AUS. I have not tested it with Home Assistant but I can toggle the switch state by sending commands via MQTT using mosquitto_pub.

Thanks so much for all the work you’ve put into this @insertjokehere . It makes my B25 switches much more useful.

Toggling in HA doesn’t work. If I hit the button in HA, it toggles in HA interface but skips to its default after a few seconds (HA-Log: WARNING (MainThread) [hbmqtt.broker] 2 messages not broadcasted). No reaction in the homemate-bridge log and no reaction on B25.

If I hit the physical button, no reaction in HA (except in DEBUG Logs), but reaction in homemate-bridge.

Thanks for your feedfback jimb0. I will try it maybe later with mosquitto. And special thanks to insertjokehere for this awesome work and your help.

//Edit: Here a debug logs of HA: B25 Registering, Turn Device off with HW Button, Turn device on

@hijinx: You don’t need an android device to extract PK. Just feed the Kepler.apk into the python script. The Kepler.apk is available for download with any device.

Hi guys. Is there any known way to get the device PK from iOS app? Or a non-android alternative?
I guess android simulatior may also be an option but no idea where to start…
Tx!

Right got you. It’s not a device specific key. Your script extracts it from the android app. Thanks got it

I just tested my B25 with the latest master version of homemate-bridge and Home Assistant, results as follows:

Works perfectly when using an external mqtt broker (mosquitto in this case). I am able to control the switch via HA without any issues.

Completely fails to work when using Home Assistant’s built-in hbmqtt.broker. Seems to be a mqtt protocol issue. None of my other mqtt devices (all using v3.1 protocol) could talk to HA’s built-in broker either.

Got it working with mosquitto. Just installed the package from the debian repos without further config.

I had to put in the configuration.yaml a mqtt-broker IP and a switch:

switch:

  • platform: mqtt
    command_topic: “homeassistant/switch/192_168_188_49/command”
    state_topic: “homeassistant/switch/192_168_188_49/state”
1 Like

Hey Snikch,

I have a pair of Orvibo S20’s (early version configured using the WiWo iOS App) but I’m completely new to Home Assistant and looking at my options for my existing smart devices.

You say that they work fine with Home Assistant but could you explain for a newbie how you got them to show up and be detected on the system please?

Much appreciated

Steve

I just followed the instructions here with discovery enabled and it worked for me. I locked in the IP once it had been discovered.