Thanks! This really helped me. I just have one problem. The values are being recorded as strings, rather than integers. Do you know where I would need to change this?
Here is how my history looks like because of this:

Thanks! This really helped me. I just have one problem. The values are being recorded as strings, rather than integers. Do you know where I would need to change this?
Here is how my history looks like because of this:

this should make the sensor value an int.
customize:
sensor.air_monitor_voc_index:
state_class: measurement
device_class: aqi
Thanks for the reply. Apologies for the ignorance, but where do I need to add this?
Later Edit:
I have tried to add the customization that @diplix suggested, but the issue persisted. However, it is not fixed after I have made the change directly in the GUI. Thanks!
Hi Ben,
Can you describe in detail how to achieve this? Which command line tool did you use to patch ZHA toolkit?
One of the easiest ways is to install the Visual Studio Code Server addon in HA.
Via the Studio Code Server addon you will be able to directly edit/change the relevant ZHA Toolkit files.
I just got an update for ZHA Toolkit and did not need the file change to zha_toolkit/zcl_attr.py. I still needed the helper to create the sensor.
I feel a bit lost
Here is what I did:
The code in zha_toolkit/zcl_attr.py is already like you wrote. So need to change
no need
created the automation, when ran it creates entity sensor.air_monitor_voc_index and I see itâs value
Then when creating the helper I expected to see in the preview the value(50), instead I see the string
When I do select the device I do see the zigbee device template is matched, but the data is no present
What Iâm doing wrong?
The code was already fixed because there was a new version of ZHA Toolkit.
I have set the template to {{ None }} instead of air_monitor_voc_index, then you shouldnât have such an issue with the diagram not showing as a graph.
You also need to run the automation in regular intervals to update the template sensor.
What do you mean have set the template to 0 ?
Automation runs every hour to update the data, but for testing I do run actions every now and then
Problem is data is available in entity, but can not make it visible in the template ![]()
You should put no text in the template sensor where you wrote air_monitor_voc_index.
I use the template {{ None }} which seems to work well
You do not see the value in the preview because it needs to written manually to the template sensor by the automation. There the state_id should match up with the entity id of the template sensor you created first.
Oh my god,
I got what was wrong.
I was running the automation, which created the sensor.
and I was trying it to get this sensor data in the template
While it;s the other way around
you have to create the template first, link it to the zigbee device. get its template id and put it inside the automation to update it.
The yaml is for an automation, not the configuration.yaml. Unless Iâve misunderstood what you are having an issue with.
I stumbled something on a page over here: Understanding Volatile Organic Compounds (VOCs) and TVOC Measurements
" Note: TVOC values in parts per million (ppm) are still available via Sensirionâs conversion formula: Sensors Thresholds"
This brought me nowhere, but I dug deeper and found this discussion
https://forums.adafruit.com/viewtopic.php?t=182288
and
Could there be a way to reverse-engineer or calculate even approximate tvoc as ppb from the voc index? One would have to know the starting point though?
Or should I just stick with the VOC index which Sensorion claims is way better than exact value?
I thought I would provide an update to @tinkerwidgetâs good work as I had to change a few things on the latest version. You might want to skip down to the end of this post to read about what the value can actually do before setting it up.
Setting up a Relative VOC Sensor
configuration.yaml (read the docs)alias: Poll - Vindstyrka VOC Sensor
description: ""
triggers:
- minutes: /1
trigger: time_pattern
conditions: []
actions:
- data:
ieee: <REPLACE ME>
use_cache: false
force_update: true
endpoint: 1
cluster: 1066
attribute: 0
action: zha_toolkit.attr_read
- data:
ieee: <REPLACE ME>
endpoint: 1
manf: 4476
cluster: 64638
attribute: 0
state_id: sensor.vindstyrka_voc_index
allow_create: true
action: zha_toolkit.attr_read
ieee value with the MAC address for your Vindstyrka device. This is found by navigating to you device list, clicking the Vindstyrka device and then clicking âZigbee infoâ within the deviceâs page.state_id as is. If you want to change it you will need to replace it in later steps as well.Confirm that your new sensor is working by navigating to âDevices & servicesâ, selecting âEntitiesâ and searching sensor.vindstyrka_voc_index. Clicking on the entity should show a numerical value getting updated every minute.
Change tab from Step 4 to âHelpersâ, click â+ Create Helperâ, select âTemplateâ and then âTemplate a sensorâ
Input the corresponding fields below into the form
Name: Relative VOC Index (24h)
State Template: {{ states('sensor.vindstyrka_voc_index') | int }}
Unit of Measurement: <Leave Blank>
Device class: Air quality index
State class: Measurement
Device: <Whatever you named your Vindstyrka>
Using the Relative VOC Index
Due to the good work in this thread from @donny007x the sensor is known to be a SEN54. What we are tapping into is Sensirionâs VOC Index which provides a 0-500 numerical value.
The summary of the hyperlinked document is that the reading is relative to a floating average of the previous 24 hours. The value 100 represents the floating average. The following is the proposed use case by Sensirion:
| VOC Index Range | Meaning |
|---|---|
| 0-150 | VOCs at or below the floating average with a buffer for small events (+50) |
| 150-250 | Trigger low remediation action. |
| 250-400 | Trigger moderate remediation action. |
| 400-500 | Trigger high remediation action. |
Leaving the situation without any external influences or remediation for 24 hours will cause the value to return 100 as the floating average accounts for the additional VOCs in the room.
Basically the reading is only good for taking corrective actions (turning on fans, air purifiers and opening windows at varying intensities). You could also send an alert with the understanding of the above. Given that it was designed to integrate with Ikea Air Purifiers this makes sense.
Closing Thoughts
The sensor is built for integration into air purifiers with a focus on implementing the NOx and VOC indexes. These arenât incredibly useful for monitoring. However, implementing readings for Raw Humidity, Raw Temperature, RAW VOC and RAW NOx from the sensor is possible at the device integration level. Ikea looks to have done this for Humidity, Temperature and NOx so it is possible they might have exposed the raw VOC in another Zigbee cluster. @donny007x seems to be the only person who had a crack at bruteforcing the endpoints so they might be able to provide more context here.
The raw VOC reading has a range of 0 - 1000 so if it exists it will likely have three attributes based on the VOC Index schema. 0 being the current value, 1 being 0 and 2 being 1000. It also might be 999 as that is what the PM2.5 bound is.
I originally had more photos for the step-by-step and a link to the raw schema but new users can only embed one image and two links.
The script looks promising but I get the same error:
Error: âDevice not found: nwk=None, ieee=Noneâ
Hi,
is it possible to control the backlight via home assistant?
Thanks in advance
Thank you very much, this helped ![]()
my log is flooded with this error:
This error comes from a custom integration.
Logger: custom_components.zha_toolkit.zcl_attr
Source: custom_components/zha_toolkit/zcl_attr.py:539
Integration: zha
Toolkit (documentation, issues)
First appearance: 01:59:52 (2192 occurrences)
Last logged: 11:12:00
Result: {0: <Status.UNSUPPORTED_ATTRIBUTE: 134>} - Attribute 0 not in read ({}, {0: <Status.UNSUPPORTED_ATTRIBUTE: 134>})
Any idea how to fix this?
Is any of this necessary anymore? I noticed that recently I had VOC Index sensors appearing out of nowhere. They definitely were not there when I initially installed my two IKEA Vindstyrka, and I have not setup any custom sensors myself. The quirk in use for both devices is specified as âzigpy.quirks.v2.CustomDeviceV2â, is this a new quirk specifically for Vindstyrka but someone forgot to put in the proper nameâŚ?
Edit: Looks like VOC Index was added to this quirk just a week or two ago.