# How to read a sensor with a homey script

**URL:** <https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962>\
**Category:** Questions & Help\
**Created:** [July 2, 2020, 8:19pm UTC](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962 "2020-07-02T20:19:47Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 12, 2024, 8:25am UTC](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962/22 "2024-03-12T08:25:40Z")

</div>

Yes, you’re right 🥴

Have you assigned the correct “plugged in” value to the Hue socket? You can do so from the device settings in the mobile app.

---

<div class="post-metadata">

**Author:** ![Arjan\_Neet](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arjan_neet/32/17808_2.png) [@Arjan\_Neet](https://community.homey.app/u/Arjan_Neet)\
**Post date:** [March 12, 2024, 8:50am UTC](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962/23 "2024-03-12T08:50:32Z")

</div>

Yes, I even checked in the device class and it is returning virtual class light, but strange enough if I check for the virtual class it returns nothing.  
Checking class and virtual class of specific lamp (connected to socket):  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/3/0314c3068eb89847b460329e9823a5bb5bf507fc.png)

Then comparing the virtual class doesn’t show the lamp, so I must be doing something wrong:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/4/b45dd7436a3c8e01fe7bcc19e518e38817a9a18e.png)

while checking for class light returns fine:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/8/0869ce80ef46bc935edfa73a679e5389b9ff368a.png)

---

<div class="post-metadata">

**Author:** ![Arjan\_Neet](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arjan_neet/32/17808_2.png) [@Arjan\_Neet](https://community.homey.app/u/Arjan_Neet)\
**Post date:** [March 12, 2024, 8:58am UTC](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962/24 "2024-03-12T08:58:09Z")

</div>

duh…, already found the issue…it must be virtualClass instead of virtualclass, I already changed it in the first statement this morning but there were no lights with virtual class active that time so I didn’t notice the difference. But now in the second script I did…  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/8/084b0d5654e75d69bd3ace020ced57dc0c597708.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 13, 2024, 9:53am UTC](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962/25 "2024-03-13T09:53:39Z")

</div>

> [@Arjan\_Neet](#):
>
> virtualClass instead of virtualclass

Maybe you type too fast 🤪  
It gets hinted often ( I don’t dare to say ‘always’ hehe):  
 ![Screenshot from 2024-03-13 10-52-07](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/d/dd5ddcbac1278d5a1f05d1833cef98f442fa9d2b.png)

---

<div class="post-metadata">

**Author:** ![Arjan\_Neet](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arjan_neet/32/17808_2.png) [@Arjan\_Neet](https://community.homey.app/u/Arjan_Neet)\
**Post date:** [March 13, 2024, 10:34am UTC](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962/26 "2024-03-13T10:34:42Z")

</div>

Yeah I need to read back what I have typed first before complaining 🙂 but my first script works now:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/5/e5168a6f130ba34b962db05eb5cc54c1ea9593d9.jpeg)  
Makes it much easier than using 3 then cards for every hue light:  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/8/b856d121c18ffeed396cdbce1d3abad3429e04b2.png)  
Maybe I will try to add a possibility to set all the lights in a specific group too, saves a few more then cards…

[Previous page](https://community.homey.app/t/how-to-read-a-sensor-with-a-homey-script/31962.md?page=1)
