Read out values from decentralized fans via IP

Hi there,

I installed several decentralized living area fans in the house. Each fan has its own IP address in the network.
With this fan there is the possibility to read out live values ​​via URL.

The command for this is for example:

http://192.168.178.39/?export=1

When I call this URL in a browser, I get the following output (pure text format):

# MUSTER FÜR MASCHINENLESBAREN YAML-EXPORT

# Das Format kann selbst angepasst werden,
# so dass die Parameter von einem Smarthome-System
# ausgelesen werden können.
# Ein weiteres Template ist z.B. als XML verfügbar

# Der Aufruf erfolgt z.B. durch:
# http://192.168.178.137/?export=1


Date: 17.09.2021
Time: 12:16:00
DeviceName: WZ-DG-ECFABCC953E
MAC: ECFABCC953E
LocalIP: 192.168.178.39
RSSI: -67
FW_MainController: 1838000A
FW_WiFi: WS181130
SystemMode: Behaglichkeitsmode
Speed_In: 10
Speed_Out: 01
Speed_AntiFreeze: 00
Temp_In: 18,0
Temp_Out: 19,9
Temp_Fresh: 17,1
rel_Humidity_In: 57,6
rel_Humidity_Out: 55,9
abs_Humidity_In: 8,9
abs_Humidity_Out: 9,6
Efficiency: 33,9
Humidity_Transport: -210
SystemOn = 1
AntiFreeze = 0
Fixed_Speed = 0
Defrosting = 0
Landlord_Mode = 0
Cross_Ventilation = 1
Timer_active = 0

Now I would like to display certain values ​​as endities in my Lovelace. The request should take place every 15 minutes. For example, I would like the following values ​​as an endity:

Temp_In: 
Temp_Out: 
rel_Humidity_Out: 

The original file on the device works with placeholders, I can adapt this file freely.
For example, if I change the file like this:

Temp_In: ~Temp_In~
Temp_Out: ~Temp_Out~

~rel_Humidity_Out~

I would get the following result when calling:

Temp_In: 18,0
Temp_Out: 19,9

55,9

Can someone explain how I can do this?

I am grateful for any help.

Greetings Werner

Change the template to generate JSON, e.g.

{
  "Temp_In": "~Temp_In~",
  "Temp_Out": "~Temp_Out~"
}

(Floating values must be string, because JSON asks for a decimal dot. You can do a replace in a template)

Then use REST to create your entities

1 Like

Hi there,

many thanks for the answer.
I have now changed my export.txt as suggested.
When calling it in the browser, I now get the following result:

{
   "Temp_In": "18,0",
   "Temp_Out": "20,1"
 }

Is it correct that way?

Unfortunately, I’m a complete beginner.
I have now tried to create the entry in the configuration.yaml for the two values ​​(temperature inside and temperature outside)
Would that be right ?:

rest:
  - authentication: basic
    scan_interval: 60
    resource: http://192.168.178.39/?export=1
    sensor:
      - name: "TEMP-IN"
        json_attributes_path: "$.response.system"
        value_template: "OK"
        json_attributes:
          - "Temp_In"
      - name: "TEMP-OUT"
        json_attributes_path: "$.response.equipment"
        value_template: "OK"
        json_attributes:
          - "Temp_Out"
        

Greetings Werner

Something is not right yet, I now get the following output:

This is what the manufacturer writes on its website:

  The following commands are available for smart home systems in HTML mode:

     192.168.0.100/?export=1 reads out the device live values ​​in YAML or XML format (template can be freely edited)

Would be

rest:
  - scan_interval: 60
    resource: http://192.168.178.39/?export=1
    sensor:
    - name: "TEMP-IN"
      unit_of_measurement: "°C"
      value_template: >
        {{ value_json["Temp_In"] | replace(",", ".") | float }}
    - name: "TEMP-OUT"
      unit_of_measurement: "°C"
      value_template: >
        {{ value_json["Temp_Out"] | replace(",", ".") | float }}
1 Like

Hi there,

Thanks very much.
When I use this in the configuration.yaml I get the following error:

missed comma between flow collection entries at line 421, column 17:
    			{{ value_json["Temp_In"] | replace(",", ".")  ... 
                    ^

Alignment issue (I think). I updated my previous post.

1 Like

Hey great !!!
It is working.
Thanks alot.

I would now like to optimize it a bit.
How could I insert the unit of measurement (in this case temperature °C and in another case%) and the correct symbol?

Thank you for your help.

Greetings Werner

Just add unit_of_measurement to the mix. Updated answer again.

1 Like

Super. Thank you thank you thank you.
With humidity it would be:?

      unit_of_measurement: "%"

Gruß Werner

Hello again,

I still have a question.
How can I give these sensors another symbol and a display name?

Thanks very much.

Greetings Werner

Use device_class.
E.g., temperature and humidity

Hi there,

yes, I’ve already looked at this page:
Customizing entities - Home Assistant
But I don’t know where to write the code.

Greetings Werner

Just under “unit_of_measurement”
It’s part of the sensor definition. Did you have a look at the documentation I pointed to?

1 Like

Thanks, now I have it.

Greetings Werner