Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual devices are not showing up #108

Open
Net-Felix opened this issue Sep 14, 2021 · 29 comments
Open

Virtual devices are not showing up #108

Net-Felix opened this issue Sep 14, 2021 · 29 comments

Comments

@Net-Felix
Copy link

Hi,

i added some Virtual devices to my SysAP. Unfortunatelly those are not showing up in HA.

regards Felix

@Tho85
Copy link
Collaborator

Tho85 commented Sep 17, 2021

Could you provide a dump of your SysAP configuration as described in the README?

@Net-Felix
Copy link
Author

Net-Felix commented Sep 18, 2021

Hi,

here is my Dump: Dump

And this is from monitor when i try to switch a virtual device through sysap webinterface:

<?xml version="1.0" encoding="UTF-8"?>
<project timeStamp="99143" sessionId="cafc3d9" type="update" mrhaVersion="2.6.4" mrhaBuild="8172">
   <privileges>
      <user name="[email protected]">
         <privilege path="807A7F04E81C" accessLevel="541" />
      </user>
   </privileges>
   <devices>
      <device serialNumber="6000EA57FCF0" domainAddress="1011" state="modified" commissioningState="ready" progress="100">
         <channels>
            <channel state="modified" i="ch0000" cid="60000148">
               <inputs>
                  <dataPoint state="modified" i="idp0000" full="false">
                     <value>1</value>
                  </dataPoint>
               </inputs>
               <outputs />
               <parameters />
               <scenes />
            </channel>
         </channels>
      </device>
   </devices>
</project>

ps: you can find the virtual devices with searching "virt_" as a all gave them this prefix

@Tho85
Copy link
Collaborator

Tho85 commented Sep 25, 2021

Hi, thanks for the detailed dump.

According to the monitor output, you switched the device with serial number 6000EA57FCF0. This corresponds to a device called virt_licht_garage in your config. As far as I can see, the XML config for virtual devices seems to be very sparse, i.e. there's not much information about the device virt_licht_garage, its channels, datapoints, functions, pairings etc.

This component relies on function IDs and pairing IDs to assign free@home devices to the correct Home Assistant entity (light, switch, climate, binary sensor...) The absence of this information for virtual devices makes it impossible to create the "correct" device in Home Assistant. Integrating these kind of virtual devices into this component would require a major rework of the config parser, without knowing if it is possible at all.

May I ask for which purpose you want to use virtual devices in free@home? I would recommend that you try to setup whatever you want to accomplish through Home Assistant instead of free@home. I bet there's a way to implement your use case without free@home virtual devices.

@derjoerg
Copy link

Hi,
I have the same problem.

My usecase is the following:
I have the 7-inch wall panel.
I want to start a HA-Automation, when a specific icon is pressed.
I already created an empty scene in fah, it shows up in HA and I can add it to the panel, but I don't see a possibility in HA to check if the icon was pressed on the panel.
So I thought I create a virtual device (e.g. BinarySensor) in fah, put it on the panel and maybe this can be tracked by HA.

Or is there another possibility for my usecase?

Thanks in advance
Joerg

@Net-Felix
Copy link
Author

same here, i got the 10" wall panel and got some external devices that i want to switch with, therefore i created virtual devices that can be displayed on the panel

@Tho85
Copy link
Collaborator

Tho85 commented Oct 3, 2021

There should be another way to do this, by using the emulated_hue component.

If you configure emulated_hue, Home Assistant will appear as a Philips Hue bridge for other devices on your network. You can then add this simulated Philips Hue brige to your free@home SysAP. After the initial discovery, it looks like this:
grafik

The simulated Hue bridge then exposes devices, scenes, scripts etc. from your Home Assistant to free@home:
grafik

You should then be able to drop these devices to your floor plan or add them to your wall panel. You may want to take a look at the emulated_hue docs in order to find out how to select which entities to expose to free@home.

A downside of this approach is that everything (scenes, covers, automations etc.) appears as a light bulb in free@home. The virtual devices approach has support for more device classes, however this is not yet implemented in this component.

@Bos2023
Copy link

Bos2023 commented Jan 5, 2023

Just as some feedback on this question:

May I ask for which purpose you want to use virtual devices in free@home? I would recommend that you try to setup whatever you want to accomplish through Home Assistant instead of free@home. I bet there's a way to implement your use case without free@home virtual devices.

In free@home it is possible to connect many other devices and systems that are integrated by using the virtual devices. For example Motionblinds can be connected to free@home and are shown as "native free@home" devices, by using the virtual devices. (yes, you can connect motionblinds directly to HA as well)
Till now I have been using free@home and openhab / nodered but very recently switched to HA. In openhab nodered you can easily use the virtual devices to activate certain things or visualise measurements of 3rd party devices in the free@home app by using the virtual devices.
Information about the virtual devices can be found here.https://developer.eu.mybuildings.abb.com/fah_cloud/reference/pairingids/

In my openhab / nodered setup I use a free@home virtual device to select the zones I wish to clean and the start / dock mode. I was hoping to eliminate the nodered part, but it seems I will have to continue using it.

@derjoerg
Copy link

Hi,

as the emulated-Hue way to work between HA and F@H is currently (6 months I guess) broken I would really like to ask if the "virtual device" way can be checked again.

I'm not python-programmer but I have a deeper understand of pogramming-languages (js, php). I can play around a lot at home if it helps regarding F@H, HA, Hue, scripting and so.

I saw several tutorials to interact with F@H (virtual devices) and OpenHAB and Node-Red, but an integration in HA would be awesome ... even if it will stay an advanced feature with no simple to use WebGUI.

@derjoerg
Copy link

Hi,

I just got a working bi-directional communication up between F@H and HA using Node-Red (websocket and Rest-Api) and a virtual device (switch).

:)

@Tho85
Copy link
Collaborator

Tho85 commented Jan 27, 2023

as the emulated-Hue way to work between HA and F@H is currently (6 months I guess) broken

Why exactly is emulated_hue broken? It works fine for me.

@derjoerg
Copy link

derjoerg commented Jan 27, 2023

Hi,

look e.g. at #144 and the links in one of the comments. So it is not a freeathome-Probleme, it really seems to be that something in HA after 2022.6.7 changed realted to emulated_hue.

@KKlausl
Copy link

KKlausl commented Aug 11, 2023

Hi,

I just got a working bi-directional communication up between F@H and HA using Node-Red (websocket and Rest-Api) and a virtual device (switch).

:)

Hi @derjoerg, Im very interessted in your solution, because I use virtual devices on my 7" panel also to control 3rd party devices via openhab - but I want to (fully) migrate to HA.

in openhab the FH binding allows to integrate vitual devices - so I didnt have to go via nodered. Now maybe - till virtual devices are shown in this integration (see latest issue) - maybe your workaround fits my needs.

Thank you in advance for your efforts... needless to say, I am no specialist in nodered - but I somehow manged, to feed a virtual inverter in FH via openhab/nodered.

@derjoerg
Copy link

Hi @KKlausl,

So there are two ways to consider:

  1. Change something in HA and update it in F@H
  2. Change something in F@H and update it in HA

For the first topic (I used a switch for that):

  1. Create an input_boolean helper in HA
  2. Create a virtual device in F@H with the API
    a. http://[ip-of-sysap]/swagger/fhapi
    b. /api/rest/virtualdevice/....
    c. I set ttl to -1 and used as type: SwitchingActuator
    d. In the return message you will get a virtual serial number starting with 6000xxx (remember it)
  3. Assign the virtual device in F@H to a room and place it on a panel
  4. Now in Node-Red
  5. I created a "trigger: state" node, which reacted, when the input_boolean got the state "true"
  6. Then I have a "change" node for "true" and for "false"
  7. in the true change node I set msg.payload to 1
  8. in the false change node in set msg.payload to 0
  9. Both "change" nodes resulted in one "http-request" node with basic authentication and method "PUT"
    a. http://[ip-of-sysap]/fhapi/v1/api/rest/datapoint/00000000-0000-0000-0000-000000000000/[serial-number].ch0000.odp0000

Now the other way round (I use this for bi-directional virtual devices, but also for the doorbell, the fire- and co-alarm, the movement-sensors, and for some automated lights if I can restrict them by a button to stay on)

  1. Create the necessary helper in HA
  2. In Node-Red
  3. Create a "websocket in" node
    a. ws://[user]:[password]!@[ip-of-sysap]/fhapi/v1/api/ws
  4. Create a "json" node and convert msg.payload to Javascript-Object
  5. Create a "function" node to get only datapoint messages
let result = [];

if (msg.payload["00000000-0000-0000-0000-000000000000"].hasOwnProperty("datapoints")) {

    for (let datapoint in msg.payload["00000000-0000-0000-0000-000000000000"].datapoints) {
        result.push([datapoint, msg.payload["00000000-0000-0000-0000-000000000000"].datapoints[datapoint]]);
    }

    msg.payload = result;
} else {
    return null;
}

return msg;
  1. Create a "split" node to have each message in a dedicated payload
  2. Now the BIG "function" node
    a. Define as much outputs as devices you want to listen to (I e.g. have 22 :) )
    b. In the Start tab define which serials you want to listen to
let filters = {
    "0": { // Bi-Directional Switch
        "serial": "6000xxxxxxxx",
        "output": []
   "1": { // Doorbell
        "serial": "ABByyyyyyyyy",
        "output": []
    },
    "2": { // CO
        "serial": "E11223344556",
        "output": []
    "3": { // Light fixed
        "serial": "ABB223344556",
        "output": []
    }
};

context.set("my_filters", filters);

let keys = [];

for (let key in filters) {
    keys.push(filters[key].serial);
}

context.set("my_keys", keys);

c. In the function tab define the logic, just remember, you have to send an array with payloads in the correct order

let payload = msg.payload;
let result = [];
let needed = false;
let filters = context.get("my_filters");
let keys = context.get("my_keys");

let values = payload[0].split("/");

if (keys.includes(values[0])) {

    for (let key in filters) {

        if (filters[key].serial == values[0]) {
            needed = true;
            result.push(
                {
                    "payload": {
                        "serial": values[0],
                        "channel": values[1],
                        "datapoint": values[2],
                        "value": payload[1]
                    }
                }
            );
        } else {
            result.push(null);
        }

    }

}

if (needed) {
    return result;
}
  1. Now you have to put a "switch" node to each output
    a. For a Bi-Directional switch you have to check the datapoint "idp0000" (payload[0].datapoint = "idp0000" and payload[0].value = "1") and can then use a "call service" node to modify HA
    b. For my doorbell I use the following (payload[0].channel = "ch0018" and payload[0].datapoint = "odp0000" and payload[0].value = "1") and then modify an input_button
    c. For CO (payload[0].datapoint = "odp0000" and payload[0].value = "1") and also an input_button
    d. For a fixed light (payload[0].channel = "ch0001" and payload[0].datapoint = "odp0003" and payload[0].value = "4")

I hope this helps

@KKlausl
Copy link

KKlausl commented Aug 15, 2023

Hi @derjoerg,
Thank you very much for your work and expertise and this detailled guide!! I really appreciate your effort!! :)
I will try your steps as soon as possible (for the next 10 days I‘m on a boat trip in france:) cant wait for it…

@janpschaefer
Copy link
Contributor

Hey guys could you make it work? on my side virtual devices are exposed to HA which is amazing. But If I try e.g. to activate a switch (actuator) on both sides free@home or HA, the state doesn't change on the other side and goes back to previous state.

@KKlausl
Copy link

KKlausl commented Oct 3, 2023

Hey guys could you make it work? on my side virtual devices are exposed to HA which is amazing. But If I try e.g. to activate a switch (actuator) on both sides free@home or HA, the state doesn't change on the other side and goes back to previous state.

I had a similar problem, which seems to be caused of free@home. Solution was for me, to „tweak“ a Backup File and reload it, see here:[ Link] (https://community.openhab.org/t/busch-jaeger-free-home/31043/559?page=28). Maybe this works for you too - of you have the nerves ;)).

@alexio70
Copy link

alexio70 commented Jun 4, 2024

Hi @KKlausl,

So there are two ways to consider:

  1. Change something in HA and update it in F@H
  2. Change something in F@H and update it in HA

For the first topic (I used a switch for that):

  1. Create an input_boolean helper in HA
  2. Create a virtual device in F@H with the API
    a. http://[ip-of-sysap]/swagger/fhapi
    b. /api/rest/virtualdevice/....
    c. I set ttl to -1 and used as type: SwitchingActuator
    d. In the return message you will get a virtual serial number starting with 6000xxx (remember it)
  3. Assign the virtual device in F@H to a room and place it on a panel
  4. Now in Node-Red
  5. I created a "trigger: state" node, which reacted, when the input_boolean got the state "true"
  6. Then I have a "change" node for "true" and for "false"
  7. in the true change node I set msg.payload to 1
  8. in the false change node in set msg.payload to 0
  9. Both "change" nodes resulted in one "http-request" node with basic authentication and method "PUT"
    a. http://[ip-of-sysap]/fhapi/v1/api/rest/datapoint/00000000-0000-0000-0000-000000000000/[serial-number].ch0000.odp0000

Now the other way round (I use this for bi-directional virtual devices, but also for the doorbell, the fire- and co-alarm, the movement-sensors, and for some automated lights if I can restrict them by a button to stay on)

  1. Create the necessary helper in HA
  2. In Node-Red
  3. Create a "websocket in" node
    a. ws://[user]:[password]!@[ip-of-sysap]/fhapi/v1/api/ws
  4. Create a "json" node and convert msg.payload to Javascript-Object
  5. Create a "function" node to get only datapoint messages
let result = [];

if (msg.payload["00000000-0000-0000-0000-000000000000"].hasOwnProperty("datapoints")) {

    for (let datapoint in msg.payload["00000000-0000-0000-0000-000000000000"].datapoints) {
        result.push([datapoint, msg.payload["00000000-0000-0000-0000-000000000000"].datapoints[datapoint]]);
    }

    msg.payload = result;
} else {
    return null;
}

return msg;
  1. Create a "split" node to have each message in a dedicated payload
  2. Now the BIG "function" node
    a. Define as much outputs as devices you want to listen to (I e.g. have 22 :) )
    b. In the Start tab define which serials you want to listen to
let filters = {
    "0": { // Bi-Directional Switch
        "serial": "6000xxxxxxxx",
        "output": []
   "1": { // Doorbell
        "serial": "ABByyyyyyyyy",
        "output": []
    },
    "2": { // CO
        "serial": "E11223344556",
        "output": []
    "3": { // Light fixed
        "serial": "ABB223344556",
        "output": []
    }
};

context.set("my_filters", filters);

let keys = [];

for (let key in filters) {
    keys.push(filters[key].serial);
}

context.set("my_keys", keys);

c. In the function tab define the logic, just remember, you have to send an array with payloads in the correct order

let payload = msg.payload;
let result = [];
let needed = false;
let filters = context.get("my_filters");
let keys = context.get("my_keys");

let values = payload[0].split("/");

if (keys.includes(values[0])) {

    for (let key in filters) {

        if (filters[key].serial == values[0]) {
            needed = true;
            result.push(
                {
                    "payload": {
                        "serial": values[0],
                        "channel": values[1],
                        "datapoint": values[2],
                        "value": payload[1]
                    }
                }
            );
        } else {
            result.push(null);
        }

    }

}

if (needed) {
    return result;
}
  1. Now you have to put a "switch" node to each output
    a. For a Bi-Directional switch you have to check the datapoint "idp0000" (payload[0].datapoint = "idp0000" and payload[0].value = "1") and can then use a "call service" node to modify HA
    b. For my doorbell I use the following (payload[0].channel = "ch0018" and payload[0].datapoint = "odp0000" and payload[0].value = "1") and then modify an input_button
    c. For CO (payload[0].datapoint = "odp0000" and payload[0].value = "1") and also an input_button
    d. For a fixed light (payload[0].channel = "ch0001" and payload[0].datapoint = "odp0003" and payload[0].value = "4")

I hope this helps

Hi https://github.com/derjoerg What a great suggestion to get the interaction between HA and F@H improved; I am having an issue getting step 7 with the BIG "function' to have the correct syntax; Node Red is reporting an issue; would you mind re-checking your example code "In the Start tab" ? and advice what you mean with the function TAB (you mean the "On Message" tab ?? THX

@derjoerg
Copy link

derjoerg commented Jun 4, 2024

Hi @alexio70,
I just recognized that I forgot two closing brackets:

Here is the corrected code for the "On Start" tab (and yes, with function tab I mean "On Message"):

let filters = {
    "0": { // Bi-Directional Switch
        "serial": "6000xxxxxxxx",
        "output": []
    },
    "1": { // Doorbell
        "serial": "ABByyyyyyyyy",
        "output": []
    },
    "2": { // CO
        "serial": "E11223344556",
        "output": []
    },
    "3": { // Light fixed
        "serial": "ABB223344556",
        "output": []
    }
};

context.set("my_filters", filters);

let keys = [];

for (let key in filters) {
    keys.push(filters[key].serial);
}

context.set("my_keys", keys);

@alexio70
Copy link

alexio70 commented Jun 4, 2024

Hi https://github.com/derjoerg What a great suggestion to get the interaction between HA and F@H improved; I am having an issue getting step 7 with the BIG "function' to have the correct syntax; Node Red is reporting an issue; would you mind re-checking your example code "In the Start tab" ? and advice what you mean with the function TAB (you mean the "On Message" tab ?? THX

@alexio70
Copy link

alexio70 commented Jun 4, 2024

Hi https://github.com/derjoerg Many many thanks for your swift reply; that really helped me a lot !! Mvg Alexio

@alexio70
Copy link

alexio70 commented Jul 30, 2024

@derjoerg I am having a hard time to make the Node Red websocket in node connect to my free@home API. In the free@home Access Point I checked the Local API to on, and with this (cryptic) user and my default password I am able to Authorize the swagger local interface; with the same user/ password it doesn't connect when I follow step 3.

Create a "websocket in" node
a. ws://[user]:[password]!@[ip-of-sysap]/fhapi/v1/api/ws

is the ! (exclamation mark) intensionally mentioned? and how about the []? the user supposed to be the user mentioned at local API, right? I have tried a variance of this but no succes...

my password starts with @, could that be an issue?
Type is Listen on/ Connect to?

thanks for your help
ps1: not using SSL or any certificate (yet)
ps2: did logout from swagger before trying the ws in node (again)

@derjoerg
Copy link

@derjoerg I am having a hard time to make the Node Red websocket in node connect to my free@home API. In the free@home Access Point I checked the Local API to on, and with this (cryptic) user and my default password I am able to Authorize the swagger local interface; with the same user/ password it doesn't connect when I follow step 3.

Create a "websocket in" node a. ws://[user]:[password]!@[ip-of-sysap]/fhapi/v1/api/ws

is the ! (exclamation mark) intensionally mentioned? and how about the []? the user supposed to be the user mentioned at local API, right? I have tried a variance of this but no succes...

my password starts with @, could that be an issue? Type is Listen on/ Connect to?

thanks for your help ps1: not using SSL or any certificate (yet) ps2: did logout from swagger before trying the ws in node (again)

Puh, a lot of question ;)

the exclamation mark is just a typo, ignore it
the brackets [] are just used to better show the different parts, don't use them
I use as Type "Connect to"

I'm not 100% sure, but I would say that @ in your password is the problem. The syntax looks like this:
ws://user:[email protected]/fhapi/v1/api/ws
if your password now contains @ the string looks like
ws://user:@pass@1.1.1.1/fhapi/v1/api/ws
As the @ is used to separate "user:pass" from the "host", the system is confused with the two @

After a quick lmgtfy
So either encode YOUR @ with %40 or change your password:
ws://user:%[email protected]/fhapi/v1/api/ws

@alexio70
Copy link

alexio70 commented Jul 30, 2024

clear; how about the node itself: Listen on/ Connect to?
let me start off with leaving away the ! typo and change the password

@derjoerg
Copy link

clear; how about the node itself: Listen on/ Connect to?

As stated above:

I use as Type "Connect to"

@alexio70
Copy link

alexio70 commented Jul 30, 2024

YES ;-) connected thanks @derjoerg
a variation of problems solved did the trick: Wrong type (Listen to), ! typo included in the phrase; the @ in the password; logged in to swagger at the same time

@alexio70
Copy link

alexio70 commented Aug 1, 2024

@derjoerg I have tested now 2 type of devices:
A. free@home WL PlusWire sensor 2 fold (the fairly newly released one); Regardless of any connected datapoints or not in free@home this sensors report only outputs on Channel ch0010 and ch0011 (on odp0005 and odp0006 respectively) with value 1 for upper part and value 0 for the lower part of the rocker. Very need... ;-) - I guess that with a necessary binary helper and delays and resets of the value, click, double click or hold can be created and used to get Home Assistant services called... if you have any recommendations I would be glad to hear... thanks!

Now the problem one...;-)
B. free@home WL Sensorunit 2 fold (the old free@home double sensor): This behaves entirely different. For the left rocker that is configured in free@home as Light switch, both the Inputs (idp0000) and outputs (odp0000) are exposed on ch0000, with a value 1 for the upper part and a value 0 for the lower part; Would you agree that this function depends on how it is configured in free@home? In this case a Switch; The right rocker does not seem to expose any datapoints when not connected/ configured in free@home; for testing purpose it is now connected to 2 scenes (up and Down) with a "devices" name (from the swagger interface) FFFF4800000B/ C - it exposes:

"channels": {
"ch0000": {
"floor": "01",
"room": "04",
"displayName": "Scène boven",
"functionID": "4800",
"inputs": {},
"outputs": {
"odp0000": {
"pairingID": 4,
"value": "0"
}
},
"parameters": {}
}
},
"parameters": {}

Filtering on FFFF4800000B in the "BIG" Function node it seems there is no "datapoints" in the JSON because it doesn't capture the payload[].

Do you have any idea on how to capture the right rocker of a double sensor unit? Should it be connected to a virtual device?

@derjoerg
Copy link

derjoerg commented Aug 1, 2024

@alexio70 : Till now I never worked with the sensor units, neither in HA with the freeathome-component nor in NodeRed

From my perspective I do as much as possible directly in HA and only use my "NodeRed path" for the bi-directional stuff (no need for emulated_hue) and for "not yet implemented" stuff.

E.g. I used my "NodeRed path" for the firealarm, but till the last update from @jheling it is now natively in the freeathome-component, so I can rely on that.

@alexio70
Copy link

alexio70 commented Aug 1, 2024

I use the @jheling integration as well but the right rocker is also not exposed as a sensor; only if I connect Scenes to it...
The scenes are exposed; but not the rocker/ right sensor unit

@alexio70
Copy link

alexio70 commented Aug 1, 2024

for bidirectional stuff (mainly Z2M Lights) I use DIYhue now, because it seamlessly integrates in BJ free@home (as native Hue component) and lights can be connected ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants