i got a channel, that has “on” and “off” as string output.
But i would like to link a switch item to this channel.
Therefore i linked the switch item to the channel and created a .map file (and linked it to the item):
on=ON
off=OFF
The problem is, that when i toggle the switch, the channel doesnt get an update.
You might look in your logs to see what is happening. openhab.log might contain relevant error messages. events.log might show what is happening to your Item.
MAP transformation is an optional, installable add-on.
You’ll have to install it before it works.
How did you do that exactly, may we see?
Possibilities include as a parameter to the channel, which belongs to some mystery binding.
Or as a transformation profile.
Or as state presentation modifier in the ‘pattern’ metadata
Can you clarify, this is some physical action external to openHAB, or you are using UH GUI, or?
You might look in your logs to see what is happening. openhab.log might contain relevant error messages. events.log might show what is happening to your Item.
I had a look on the events at console with log:tail, also i tested the commands with the rest-api.
The channels seems to need off and on (tested with sting item at rest api), and the switch item needs ON an OFF.
MAP transformation is an optional, installable add-on.
You’ll have to install it before it works.
Yes, it is installed.
How did you do that exactly, may we see?
Possibilities include as a parameter to the channel, which belongs to some mystery binding.
Or as a transformation profile.
Or as state presentation modifier in the ‘pattern’ metadata
I created a file named miele.map at transformations folder with the following content:
Okay, that all seems to be working. When your string Item is ‘off’ your Switch type Item is OFF.
Are you trying to command your device from openHAB? (The profile and MAP will not be used in that “outbound” case)
I don’t know why the miele binding author chose to present an on-off function as a string type channel, but you’ve got you got.
I’d make a ‘dummy’ Switch type Item, for use in your user-facing UI.
And connect that with a ‘real’ String type Item linked to the binding by using two rules. One rule triggers from state updates to the real Item and postUpdates to the dummy. The other rule triggers from commands to dummy Item and resends as commands to the real Item. Both rules can take care of on/ON conversion.
I’d work the rules a little differently, paying attention to the difference between commands and states.
// passing command from dummy to device
rule "Control Miele CM6 Power"
when
Item MieleKaffeevollautomatCM6560_Power_SW received command
// don't trigger from state if interested in commands
then
if (receivedCommand == ON) {
// don't look at state if interested in commands
Miele_CM6560_Power.sendCommand('on')
}
else if (receivedCommand == OFF) {
Miele_CM6560_Power.sendCommand('off')
}
end
// passing device state to dummy
rule "Update Miele CM6 Power Dummy item"
when
Item Miele_CM6560_Power received update
then
if (Miele_CM6560_Power.state == "on") {
MieleKaffeevollautomatCM6560_Power_SW.postUpdate(ON)
// if you want to update, then update - don't command
}
else if (Miele_CM6560_Power.state == "off") {
MieleKaffeevollautomatCM6560_Power_SW.postUpdate(OFF)
}
end