Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mqtt.homeassistant] availability doesn't have to be a list #17375

Open
adielsa opened this issue Sep 6, 2024 · 11 comments
Open

[mqtt.homeassistant] availability doesn't have to be a list #17375

adielsa opened this issue Sep 6, 2024 · 11 comments
Labels
bug An unexpected problem or unintended behavior of an add-on external bug A problem or unintended behavior of an external library

Comments

@adielsa
Copy link

adielsa commented Sep 6, 2024

There is amazing nuki_hub over esp32 that send mqtt
i tried to connet it to OpenHAb. Its even send homeassisnt mqtt message but its doesnt get register.

Which config topic should i use?

I see that MQTT got connected from nuki_hub to openhab

OpenHab side:
image
image

NukiHub ESP:
image
image

@adielsa
Copy link
Author

adielsa commented Sep 6, 2024

I fixed missing config of topic. And i see now the following topic+message on the broker but they are not been consume by the add-on
image

@adielsa
Copy link
Author

adielsa commented Sep 6, 2024

using openhab-cli showlogs i manage to discover:

openhabian@openhabian:~ $ openhab-cli showlogs

==> /var/log/openhab/events.log <==
2024-09-06 10:39:11.325 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2024-09-06 10:39:11.424 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from INITIALIZING to UNKNOWN
2024-09-06 10:39:32.424 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNKNOWN to UNINITIALIZED
2024-09-06 10:39:32.595 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)
2024-09-06 10:39:33.611 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2024-09-06 10:39:33.728 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from INITIALIZING to UNKNOWN
2024-09-06 10:40:28.825 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNKNOWN to UNINITIALIZED
2024-09-06 10:40:28.978 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)
2024-09-06 10:40:30.369 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2024-09-06 10:40:30.471 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:homeassistant:c4b5e522c7:c6ebc32482' changed from INITIALIZING to UNKNOWN

==> /var/log/openhab/openhab.log <==
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.54.v20240208]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.54.v20240208]
	at java.lang.Thread.run(Thread.java:840) [?:?]
2024-09-06 10:40:27.368 [WARN ] [nal.discovery.HomeAssistantDiscovery] - HomeAssistant discover error: invalid configuration of thing smartlock component lock: Cannot parse channel configuration JSON
2024-09-06 10:40:27.391 [WARN ] [ssistant.internal.DiscoverComponents] - HomeAssistant discover error: invalid configuration of thing smartlock component lock: Cannot parse channel configuration JSON
2024-09-06 10:40:30.529 [WARN ] [nal.discovery.HomeAssistantDiscovery] - HomeAssistant discover error: invalid configuration of thing smartlock component lock: Cannot parse channel configuration JSON
2024-09-06 10:40:30.563 [WARN ] [ssistant.internal.DiscoverComponents] - HomeAssistant discover error: invalid configuration of thing smartlock component lock: Cannot parse channel configuration JSON

@ccutrer
Copy link
Contributor

ccutrer commented Sep 10, 2024

Can you post the full value of the homeassistant/lock/3a855b25/smartlock/config topic from MQTT? And I assume you're on 4.3.0.M1 (or a recent snapshot)?

@adielsa
Copy link
Author

adielsa commented Sep 11, 2024

nuki>configuration>basicjson
{"nukiID":"3a855b25","name":"F1","autoUnlatch":0,"pairingEnabled":1,"buttonEnabled":1,"ledEnabled":1,"ledBrightness":3,"currentTime":"2024-09-10 06:39:22","timeZoneOffset":0,"dstMode":0,"hasFob":0,"fobAction1":"Intelligent","fobAction2":"Unlock","fobAction3":"Lock","singleLock":0,"advertisingMode":"Automatic","hasKeypad":0,"hasKeypadV2":0,"firmwareVersion":"4.3.10","hardwareRevision":"8.3","homeKitStatus":"Not Available","timeZone":"Asia/Jerusalem"}

nuki>configuration>advancesjson
{"totalDegrees":0,"unlockedPositionOffsetDegrees":0,"lockedPositionOffsetDegrees":0,"singleLockedPositionOffsetDegrees":0,"unlockedToLockedTransitionOffsetDegrees":0,"lockNgoTimeout":20,"singleButtonPressAction":"Intelligent","doubleButtonPressAction":"Lock n Go","detachedCylinder":0,"batteryType":"Accumulators","automaticBatteryTypeDetection":1,"unlatchDuration":3,"autoLockTimeOut":300,"autoUnLockDisabled":0,"nightModeEnabled":0,"nightModeStartTime":"22:00","nightModeEndTime":"06:00","nightModeAutoLockEnabled":1,"nightModeAutoUnlockDisabled":1,"nightModeImmediateLockOnStart":1,"autoLockEnabled":1,"immediateAutoLockEnabled":1,"autoUpdateEnabled":1}

nuki>lock>json
{"lock_state":"locked","lockngo_state":0,"trigger":"autoLock","currentTime":"2024-09-10 07:07:06","timeZoneOffset":0,"nightModeActive":0,"last_lock_action":"Unlock","last_lock_action_trigger":"autoLock","lock_completion_status":"success","door_sensor_state":"unavailable","auth_id":0,"auth_name":""}

image

@ccutrer
Copy link
Contributor

ccutrer commented Sep 11, 2024

Those are all values about the device itself, and not the discovery information from the topic I requested.

@adielsa
Copy link
Author

adielsa commented Sep 20, 2024

@ccutrer
Copy link
Contributor

ccutrer commented Sep 20, 2024

The configuration JSON does not follow the specification. For the "avty" entry, the docs describe it as a list [of objects] (i.e. an Array), but your device is sending a single object. I've opened a PR against nuki_hub to fix it, but I have no way of testing that code change works on their end. I have confirmed that changing the configuration metadata as I show there, the device then shows up in my openHAB inbox.

ccutrer added a commit to ccutrer/openhab-addons that referenced this issue Sep 20, 2024
…arsing fails

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la openhab#17375.
ccutrer added a commit to ccutrer/openhab-addons that referenced this issue Sep 20, 2024
…arsing fails

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la openhab#17375.
ccutrer added a commit to ccutrer/openhab-addons that referenced this issue Sep 20, 2024
…arsing fails

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la openhab#17375.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
lsiepel pushed a commit that referenced this issue Sep 20, 2024
…arsing fails (#17452)

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la #17375.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
@lsiepel
Copy link
Contributor

lsiepel commented Sep 20, 2024

Would be nice if you can link the PR so we can track it here.

@lsiepel lsiepel added bug An unexpected problem or unintended behavior of an add-on external bug A problem or unintended behavior of an external library labels Sep 20, 2024
@ccutrer
Copy link
Contributor

ccutrer commented Sep 20, 2024

I did link it in my comment (but as an inline link, not as part of the text). technyon/nuki_hub#475. Do we need to put it anywhere else?

@lsiepel
Copy link
Contributor

lsiepel commented Sep 20, 2024

No, just somehow misread it. Perfectly fine as is.

@ccutrer ccutrer changed the title [mqtt.homeassistant] Unsupported Device https://github.com/technyon/nuki_hub [mqtt.homeassistant] availability doesn't have to be a list Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on external bug A problem or unintended behavior of an external library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants