eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
861 stars 787 forks source link

[MQTT] HASS binding ignores "payload_on"/"payload_off" directives in 2.5.0M1 #6885

Closed wildwiz closed 5 years ago

wildwiz commented 5 years ago

The MQTT binding successfully discovers the devices (via HASS discovery), properly reports them as online, but it then fails to control them.

Expected Behavior

Flipping an MQTT bound Item from PaperUI/Control should cause the appropriate MQTT message to be sent to the broker.

Current Behavior

Flipping an MQTT bound Item from PaperUI/Control causes the following WARNs in openhab.log. The MQTT message is actually sent, but with the wrong content. Details

Details

Configuration JSON of the discovered Thing attached to the Item (discovered with HASS discovery):

{"name":"sw1","platform":"mqtt","state_topic":"sw1/relay/0",
 "command_topic":"sw1/relay/0/set","payload_on":"1","payload_off":"0",
 "availability_topic":"sw1/status","payload_available":"1","payload_not_available":"0"}

note "payload_on":"1","payload_off":"0"

Warning registered in logs:

2019-02-05 21:22:14.710 [WARN ] [eneric.internal.generic.ChannelState] - Command '1' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.1
2019-02-05 21:22:17.224 [WARN ] [eneric.internal.generic.ChannelState] - Command '0' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.0

Content in the MQTT message actually sent contains the text "true"/"false" rather than "1"/"0", which the device does not recognize.

Steps to Reproduce

Via Paper UI:

  1. Discover a Thing via HASS discovery from MQTT with discovered content as mentioned in JSON configuration.
  2. Link the Thing to an Item.
  3. Operate the Item flipping the switch on and off.
  4. Check the MQTT output carrying the wrong payload.

Additionally, I suspect that the capture of the actual state from MQTT is failing as well for similar reasons.

Environment

OpenHab reinstalled from scratch, no other configurations or status in the way. Version used: OpenHab and addons 2.5.0.M1

Java: both

Operating System and version: both

davidgraeff commented 5 years ago

This is not the correct repository to report MQTT addon issues :) Please use openhab2-addons.

wildwiz commented 5 years ago

I figured out it wrong again ... sorry and thank you !