ON, OFF, STATE with HTTP- and REGEX-Binding

Switch gs1 "gs1 [%s]" {http=">[ON:GET:http://admin:admin@192.168.125.101/goform/device?cmd=set&alarmout.status=1] >[OFF:GET:http://admin:admin@192.168.125.101/goform/device?cmd=set&alarmout.status=0] "}
Number gs2 "gs2 [%s]" {http="<[http://admin:admin@192.168.125.101/goform/device?cmd=get:5000:REGEX(.*?alarmout.status=.*?([0-9\\,]*).*)]"}

With the switch it is possible to turn “something” on and off.
With the number item i get 0 or 1 back.
So far so good - but is it possible to combine these two items?

Switch gs3 "gs3 [%s]" {http=">[ON:GET:http://admin:admin@192.168.125.101/goform/device?cmd=set&alarmout.status=1] >[OFF:GET:http://admin:admin@192.168.125.101/goform/device?cmd=set&alarmout.status=0] <[http://admin:admin@192.168.125.101/goform/device?cmd=get:5000:REGEX(.*?alarmout.status=.*?([0-9\\,]*).*)] "}

This can not work, because REGEX gives me 0 or 1 - is there a way to transform it to ON or OFF within the item?

Thank you…

You could try a MAP transform or a rule that translates the values, examples for the latter can be found here: http://docs.openhab.org/configuration/rules-dsl.html#using-state-of-items-in-rules
for the former look here: http://docs.openhab.org/addons/transformations.html

Changing the state of a switch with a rule is no problem - but some kind of workaround.
I just can´t believe, that i have to use a rule to do such a simple job.

Thank you for the links - unfortunately i don´t see the solution… :frowning: