Yio Remote Community

Ideas for remote implementation

The master branch, after compiled, is uploaded to a github release. Right now the remote is looking for these, checks the version and if it’s newer, downloads and replaces the files.

It is much more complicated to integrate the GUI for a TV or a Media Player (with browse support) as plugin.

True, but that depends on how you approach it. If you take for example a certain GUI which has all the options (and possibilities for favorites) and make ‘what’ that component shows configurable on a per screen basis, i think you are almost there. I don’t want to ‘mimic’ the Neeo but i think taking the best of that SDK doesn’t hurt.

Looking at their readme.

The view for a device in the recipe is generated automatically depending on the device capabilities.

See widget documentation for more details on the way default views are generated.

Which in turn says:

The view for devices is dynamically generated based on their capabilities and components. This process is done in three steps:

  1. A list of compatible widget is generated for the recipe view
  2. Slides are generated based on the available widgets
  3. Slider are reordered or hidden based on user settings

Check here how i did it for Neeo: https://github.com/Webunity/neeo-driver-ziggo-horizon/blob/master/index.js#L29
Docs: https://neeoinc.github.io/neeo-sdk/#src-lib-models-devicebuilder.ts-addbuttongroup

If you look at some of the pictures:

This ‘view’ consists probably of 4 button groups:

  • Color buttons
  • Numpad
  • Guide
  • Info

If you add only ‘one’ of them (in your device definition) this view would be shown. One thing i hope will be possible (somehow, probably have to code it myself) is the possibility to add ‘favorites’ to a device, like shown in below picture;

I don’t know where to store them etc etc. but you also see that one ‘recipe’ is a combination of multiple ‘views’ (the dots at the top of the screen)

I have implemented now a more thoughtful version of entity objects. I think they should be implemented in C++ to get the optimal functionality with minimum resource usage. But I have made a great effort to make the implementation of new entities as easy as possible.

And I implemented an integration plugin DLL sample which shows how to add an integration without recompiling.

You can take a look : https://github.com/ChristianRiedl/yio-remote

Until now it is tested only on Windows. If @marton want’s to go in this direction I will test it on the PI.

My next project will be a prototype of a simple TV integration with GlobalCache IR sender.

Here a bit more about my current solution :

Goals :

  • GUI objects like components/light/Button should work with integration-neutral entities.

  • This entities should be able to provide the GUI with a comfortable easy to use interface.

  • This entities should not use more ressources as necessary (only possible with C++)

  • Transforming integration specific formats into standard entity attributes and back (commands) is part of the one and only integration module

  • Integrations can be implemented as qml or C++ modules

  • Integrations can be implemented as Plugin DLLs to allow adding of integrations without recompiling the remote software

Implementation :

  • Entity : Base class implementing common features of the entity object

  • LightEntity : Light entity implementation

  • Entities : Singleton root object containing all entity objects. Entities is global accessible (“all_entities”)

The C++ sources are inside /sources/entities
Entities are created in main.qml based on the config.json entities. config.json entities are replaced by the entity objects

  • Integration Plugin DLL loading:

The name of the plugin dll is configured by an additional property “plugin” containing the name of the dll in config.json / integration

Handled by an extension of launcher.cpp. Dlls have to be stored in the Plugin directory

Required changes :

main.qml/LoadEntities : replace config.json entities against Entity object

helper.js/saveConfig : before writing the entity object it is replaced by an object containing only the properties which should be stored.

components/light/Button.qml : make use of the light entity object (getting attributes, features, send commands)

integration/homeassistent.qml Add the transformation to and from standard-entity

Status :

Tested on Windows 10 / VS2017 with modified homeassistent.qml and my MQTT based pluging interface DLL (SmartHomePlugin)

Thanks so much for your work and suggestions @ChristianRiedl! I agree that tackling the entities in C++ is less resource heavy.

I’m not sure DLLs would work on linux and I still think that having plugins is not a high priority right now, but in the future it could be handy.

Anyways, I’ll look into merging your ideas once I’m done with the things I’m working on right now.

A post was split to a new topic: OLED display consideration

There are shared libraries (.so) in Linux too. I see no reason why it should not work.

I will start to try my version on a PI Zero W.

On which platform do you create the PI Zero executable ? Theoretically it should be possible to cross compile with MinGW on Windows, but I never tried it.

Cool, I didn’t know it existed.

I’m cross compiling on my mac running linux.

I started to setup a PI Zero W for testing. My biggest problem is to get a suited Qt Version on the PI.
I was able to compile the remote with Qt 5.7.1 which is available for the PI. I learned that compiling on the PI Zero is acceptable for a project of similar size (5 - 10 minutes). But YIO remote requires minimum Qt version 5.7.11. I did not find binary packages for the PI newer than 5.7.1.
So the only possibility is to build it from the sources ?
At first I tried it on Windows 10 with VisualGdb. I failed.
I wanted to avoid setting up Linux on my PC so I decided to build it on the PI Zero following this instructions :

https://www.tal.org/tutorials/building-qt-512-raspberry-pi

It is running now for 12 hours and I am not sure if and when I will get a running Qt. …

Does somebody know where to get binary packages >= 5.11 for the PI ?

I cross compiled Qt for the Pi.

You can use the buildroot config to create an OS. Or I can upload the image file so you can download it.

After hours of compilation I got an error “invalid conversion from ‘xcb_window_t {aka unsigned int}’ to ‘EGLNativeWindowType {aka void*}’”. This error can be googled on several sites, reason is unclear.

Would be great if you can upload the image.

@ChristianRiedl Sure. I’ll upload the image after work today.

Hey! Here is a link to the buildroot image:

Before you burn it to the SD card, don’t forget to change the wpa supplicant file to set your wifi credentials:
/etc/wpa_supplicant/wpa_supplicant-wlan0.conf

Otherwise you can access the Pi via serial if you have a uart to USB converter and change the config.txt and cmdline.txt on the boot partition.

username is root and password is yioremote.

Thanks a lot. I think it is good when we work on the same image and Qt Version.

Indeed. Hope you managed to make it work.

I transfered it on Windows 10 with “Etcher” to the SD-card. But it stops booting after some seconds.
Without displaying any information on the HDMI display.

I also tried to replace config.txt against a default one, containing only hdmi_safe=1. No success.

Which tool do you use to transfer the .img ?

I also use Etcher, but on a Mac. Shouldn’t make a big difference.

Have you replaced also the cmdline.txt with the default one? You’ll need to do that to see something on the HDMI display.

I modified config.txt (like in my working Full Raspian image) :
#empty file

and cmdline.txt :
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles

Now I see on the HDMI monitor a boot log. But PI seems to stop during setup of the network.
(I tried several variants of the cmdline.txt).

I am not able to modify on Windows 10 wpa_supplicant.conf, I can only read the Linux file system insite the .img file. But I think PI should boot even if the SSID is not correct.

But I found general differences in wpa_supplicant.conf between your image and my working (Full Raspian) image, maybe this is the problem.

Wlan config in my working image :

/etc/wpa_supplicant directory contains 3 shell files (action_wpa.sh, functions.sh, ifupdown.sh)
and this /etc/wpa_supplicant/wpa_supplicant.conf file :
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AT
network={
ssid=“RICNET”
psk=“xxxxxxxxx”
}

Wlan config in your image :

/etc contains a wpa_supplicant.conf file :
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
network={
key_mgmt=NONE
}

and /etc/wpa_supplicant directory contains only a wpa_supplicant-wlan0.conf :
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
network={
key_mgmt=WPA-PSK
ssid=""
psk=""
}

I am sorry that I torture you with my problems. Unfortunately, I am very weak with Linux.

The boot process will wait a minute or two for the network, if it is not successful it will continue anyways. I suggest you wait a bit longer.

I am using systemd/networkd for the networking and not the default Raspbian version. That is why the setup and files are different.

I’ll see if I have time in the weekend to do a quick bash script that copies the config over from the boot partition so you’ll be able to place the wifi config file on the boot partition next to config.txt

@marton
Waiting a bit longer was not successfull. The PI crashed during booting after a few seconds. Green LED switched off.

So I decided to go another way. I created Qt 5.12.3 and QtCreator from the sources on the PI Zero. It took nearly a week but today it finished and I now I am able to run successfully my version with the entities and the integrator DLL (.so) with my MQTT interface on the PI Zero.

For this purpose I also implemented a YIO hardware simulator. It has a simple UI which simulates the buttons, ambient light, voltage, proximity, gesture etc. The simulator is a websocket server and in main.cpp it requires only a small change. Maybe it is useful for you to to test in your development environment :

#ifdef __sim__
    qmlRegisterType<SimDisplayControl>("DisplayControl", 1, 0, "DisplayControl");
    qmlRegisterType<SimInterruptHandler>("InterruptHandler", 1, 0, "InterruptHandler");
    qmlRegisterType<SimHaptic>("Haptic", 1, 0, "Haptic");
    qmlRegisterType<SimBattery>("Battery", 1, 0, "Battery");
    qmlRegisterType<SimProximityGesture>("Proximity", 1, 0, "Proximity");
#else
    qmlRegisterType<DisplayControl>("DisplayControl", 1, 0, "DisplayControl");
    qmlRegisterType<InterruptHandler>("InterruptHandler", 1, 0, "InterruptHandler");
    qmlRegisterType<drv2605>("Haptic", 1, 0, "Haptic");
    qmlRegisterType<BQ27441>("Battery", 1, 0, "Battery");
    qmlRegisterType<ProximityGestureControl>("Proximity", 1, 0, "Proximity");
#endif   

I also implemented a HomeAssistant simulator, as I have no home-assistant environment.
You have merged the dev branch into the master branch. If you want I can create a branch with my solution, when you give me then necessary rights. Of course I would update my solution to your latest version.