LeoFau
(Leoni Faubel)
June 11, 2021, 10:34am
1
Hello,
I have created a virtual switch with 3 states (“on”, “off”, “additional interaction”) as a settings menu in OpenHAB 3. But when clicked in the MainUI it doesn’t work and I get the following Error: [ERROR] [org.apache.cxf.jaxrs.utils.JAXRSUtils] - No message body reader has been found for class java.lang.String, ContentType: application/octet-stream
Can someone explain to me, how to fix this?
//items
Number adlSetting "ADL Setting"
Switch adlSwitch "ADL Switch"
Switch amazonEcho "Amazon Echo"
//sitemap
Switch item=adlSetting icon="smiley" mappings=[ 0="On", 1="Additional interaction", 2="Off" ]
Switch item=amazonEcho icon="microphone"
Switch item=adlSwitch icon="smiley"
//rules
rule "Abfrage ADL Status"
when
Item adlSetting received update
then
if (adlSetting.state == 0){
adlSwitch.sendCommand(ON)
amazonEcho.sendCommand(OFF)
} else if (adlSetting.state == 2){
adlSwitch.sendCommand(OFF)
amazonEcho.sendCommand(OFF)
} else {
amazonEcho.sendCommand(ON)
}
end
A switch in typical use cases is ON or OFF, have you tried using a string item?
rossko57
(Rossko57)
June 11, 2021, 2:29pm
3
Using a Number as a multi way switch is fine, common practice.
When what is clicked?
You’ve used your sitemap to make your Number look like a multi way switch for other UIs. Does that work, have you tried in BasicUI?
But MainUI takes no notice of sitemaps. You’d need to fiddle with Item metadata to fool MainUI to treat it like a switch.
See
I have a Number item that may take one of three values:
0: “0ff” , 1: “WW” 3: “WW + heat”
In BasicUI that would look like this:
Switch item=Vito_Betriebsmodus label=“Zustand [%s]” mappings=[0=“Aus”, 1=“WW”, 2=“WW+Heizen”, 66=“Party-sofort Heizen”]
What would I have to do in order to get this with the MainUI?
I tried this:
Number Vito_ManualMode “Vito_ManualMode” (gHeating) [“switchable”,“HVAC”] {
channel=“http:url:vitow…
For the rule, you would generally trigger from received command
if it is supposed to respond to UI clicks.
LeoFau
(Leoni Faubel)
June 16, 2021, 12:45pm
4
rossko57:
When what is clicked?
I have seen the entry you linked and created a widget in my MainUI so that I can click “Buttons” on my created page.
uid: 3-way-switch
tags: []
props:
parameters:
- description: ADL Setting
label: adlSetting
name: ADL Setting
required: false
type: TEXT
- context: adlSetting
description: An item to control
label: adlSetting
name: ADL Setting
required: false
type: TEXT
parameterGroups: []
timestamp: Apr 15, 2021, 12:35:30 PM
component: oh-list-item
config:
icon: f7:gear_alt
title: ADL Setting
slots:
after:
- component: f7-block
config:
style:
margin-top: 0px
slots:
default:
- component: f7-segmented
config:
raisedAurora: true
style:
min-width: 150px
slots:
default:
- component: oh-button
config:
action: command
actionItem: =props.item
actionCommand: 0
text: On
- component: oh-button
config:
action: command
actionItem: =props.item
actionCommand: 1
text: Additional interaction
- component: oh-button
config:
action: command
actionItem: =props.item
actionCommand: 2
text: Off
When one of the three options is clicked I receive the error that I described in the original post in my log.
rossko57
(Rossko57)
June 16, 2021, 1:33pm
5
The message isn’t very helpful about telling you where it came from. Often it’s about some external script.
Try disabling/removing the rule, so that thetarget Item doesn’t interact with anything else. What does your events.log
tell you arrives at this Item?
You didn’t answer if you tried with your sitemap and BasicUI, what results there.
LeoFau
(Leoni Faubel)
June 16, 2021, 2:00pm
6
Okay you’re right. I forgot to test it in the BasicUI. There the rule is working.
Thank you!
I will try to find a solution that works in the MainUI too, but for now the BasicUI is all I need.
rossko57
(Rossko57)
June 16, 2021, 2:51pm
7
Okay, so that seems to show it’s UI related. In some circumstances I think this message can arise if an Item is say NULL state to begin with.
system
(system)
Closed
July 28, 2021, 6:52am
8
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.