[SOLVED] How to change sensor text from open/closed to something else

Hello this is my first question here,
I’m using a light sensor and I’ve added it into .items as a contact
items:
Contact KY018 “Light Sensor [%s]” {gpio=“pin:23 activelow:yes”}
sitemap
Text item=KY018
in UI it sayes
Light Sensor CLOSED
or
Light Sensor OPEN

how can i customize the text CLOSED / OPEN

Thanks

Hi there, welcome to the community. You will find a lot of help from others. Here are some hints.

1.) Usre the format option. That makes your definition more readlble

Items

Contact KY018 “Light Sensor [%s]” {gpio=“pin:23 activelow:yes”}

Sitemap

Text item=KY018

2.) Use the documentation. Your Question should be answered if you read the topics about the Sitemap and the usable options. To give you some hint: You have to specify a label with a MAP Transformation. Sounds complicated, but ist isn’t. A MAP Transformation exchanges text so your CLOSED could be easyly changed to GESCHLOSSEN or something else.

I would suggest that you start digging a little more deaper into item and sitemap definitions.

Cheers Thomas

1 Like

Hi,

Not to give you an RTFM answer, but simply because I can’t explain it any better :slight_smile:

For general information regarding transformation services, click here. For a more detailed description of the Map transformation service click here.

I’m pretty sure a light sensor should be represented as a switch item rather than a contact item.
Please be aware that by using the Text widget in the sitemap, there won’t be a switch but only the text (ON or OFF). If you want to customize the status text, simply use the MAP service:
items/my.items:

Switch KY018 "Light Sensor [MAP(sensor.map):%s]" {gpio="pin:23 activelow:yes"}

sitemaps/my.sitemap:

Test item=KY018

transform/sensor.map:

ON=bright
OFF=dark
NULL=undefined

This will result in a message Light Sensor bright or Light Sensor dark

Please be aware that you first have to install the MAP service.

1 Like