Niko Home Control - EnergyMeter returning UNDEF

Tags: #<Tag:0x00007f4335a0ba48>

I’m having some odd behaviour with the live power usage from NHC binding.

I’m currently using Openhab 3.1.0.M3 milestone build on a raspberry pi 4 with openhabian.

The issue I’m having is that when I create the item

Number CurrentPower "Current Electricity Usage [%.0f W]" {channel="nikohomecontrol:energyMeter:443b00ee3af6:6dcef020-2911-424d-b1f5-40f252aec28a:power"}

Item CurrentPower always remains as UNDEF

However, when I connect directly to NHC using the app MQTT Explorer I can see that the ElectricalPower property is being returned correctly and that the ReportInstantUsage flag is getting set to ‘true’ (This is not the case unless the above item is created).

As a work around I’m still creating the item as above to toggle NHC to report live electricity data, and then I’m also creating an MQTT broker which connects to NHC and then another item with a JSONPath profile of $.Params…Properties…ElectricalPower to retrieve the value.

I’m unsure if this is a known issue with the binding, or whether it’s an issue with the milestone build, or indeed I’m doing something wrong somewhere along the way.

I do have a lot of other NHC items (thermostats, lights, dimmers, virtual flags) which are working as expected.

Any help would be much appreciated.

This sounds like a bug. I can’t say what’s going wrong, but it would be helpful to get a trace log. I may be able to see what is happening to the messages.

What happens if you use the Number:Power Item type as shown in binding docs example?

Here’s the trace (I think this is what you are after, apologies if not). As you can see, we use quite a lot of electricity here!!

2021-04-18 16:00:09.404 [TRACE] [l.nhc2.NikoHomeControlCommunication2] - received topic hobby/control/devices/evt, payload {“Method”:“devices.status”,“Params”:[{“Devices”:[{“Properties”:[{“ElectricalPower”:“4623.000”}],“Uuid”:“6dcef020-2911-424d-b1f5-40f252aec28a”}]}]}
2021-04-18 16:00:09.406 [DEBUG] [rol.internal.protocol.NhcEnergyMeter] - update power channel for 6dcef020-2911-424d-b1f5-40f252aec28a with null
2021-04-18 16:00:09.407 [TRACE] [l.nhc2.NikoHomeControlCommunication2] - received empty energy meter 6dcef020-2911-424d-b1f5-40f252aec28a power reading

It doesn’t matter if I use Number:Power or not, same behaviour either way.

Thanks. Yes, that is what I was looking for. I will look into this, but don’t promise a quick solution. I am fairly busy at the moment.

Thank you Mark, I really appreciate that.

PR #10546 should fix this.

Many thanks. Forgive my ignorance, but when will this go into the next build?

@Jorggs I believe it is already in snapshot builds, but not yet in the current milestone.

1 Like

Just upgraded to 3.1.0.M4 and have found that the Niko home control bridge is no longer working at all. Any ideas?

Screenshot attached:

log:

2021-05-03 11:08:43.531 [DEBUG] [very.NikoHomeControlDiscoveryService] - discovery service org.openhab.binding.nikohomecontrol.internal.handler.NikoHomeControlBridgeHandler2@61db89
2021-05-03 11:08:43.547 [DEBUG] [andler.NikoHomeControlBridgeHandler2] - initializing NHC II bridge handler
2021-05-03 11:08:43.551 [DEBUG] [l.nhc2.NikoHomeControlCommunication2] - initializing for mqtt connection to CoCo on 10.0.1.7:8884
2021-05-03 11:08:43.552 [DEBUG] [nal.protocol.nhc2.NhcMqttConnection2] - starting connection...
2021-05-03 11:08:43.553 [TRACE] [l.nhc2.NikoHomeControlCommunication2] - Connection state: CONNECTING
2021-05-03 11:08:43.556 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '10.0.1.7' with clientid 10_0_1_71-nikohomecontrol_bridge2_443b00ee3af6
2021-05-03 11:08:43.622 [DEBUG] [nal.protocol.nhc2.NhcMqttConnection2] - error connecting
2021-05-03 11:08:43.623 [DEBUG] [l.nhc2.NikoHomeControlCommunication2] - error in mqtt communication
2021-05-03 11:08:43.624 [DEBUG] [nal.protocol.nhc2.NhcMqttConnection2] - stopping connection...
2021-05-03 11:08:43.622 [DEBUG] [l.nhc2.NikoHomeControlCommunication2] - Connection state: CONNECTING
com.hivemq.client.mqtt.exceptions.ConnectionFailedException: javax.net.ssl.SSLHandshakeException: No subject alternative names matching IP address 10.0.1.7 found
Caused by: javax.net.ssl.SSLHandshakeException: No subject alternative names matching IP address 10.0.1.7 found
	at sun.security.ssl.Alert.createSSLException(Alert.java:131) ~[?:?]
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:349) ~[?:?]
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:292) ~[?:?]
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:287) ~[?:?]
	at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1356) ~[?:?]
	at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1231) ~[?:?]
	at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1174) ~[?:?]
	at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392) ~[?:?]
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443) ~[?:?]
	at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1074) ~[?:?]
	at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1061) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:1008) ~[?:?]
	at io.netty.handler.ssl.SslHandler.runAllDelegatedTasks(SslHandler.java:1528) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.runDelegatedTasks(SslHandler.java:1542) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1426) [bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1253) [bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1300) [bundleFile:4.1.63.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:508) [bundleFile:4.1.63.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447) [bundleFile:4.1.63.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) [bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [bundleFile:4.1.63.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.63.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [bundleFile:4.1.63.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [bundleFile:4.1.63.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) [bundleFile:4.1.63.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) [bundleFile:4.1.63.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) [bundleFile:4.1.63.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) [bundleFile:4.1.63.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [bundleFile:4.1.63.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.63.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.63.Final]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.security.cert.CertificateException: No subject alternative names matching IP address 10.0.1.7 found
	at sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:165) ~[?:?]
	at sun.security.util.HostnameChecker.match(HostnameChecker.java:101) ~[?:?]
	at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455) ~[?:?]
	at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:429) ~[?:?]
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:283) ~[?:?]
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141) ~[?:?]
	at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1334) ~[?:?]
	at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1231) ~[?:?]
	at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1174) ~[?:?]
	at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392) ~[?:?]
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443) ~[?:?]
	at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1074) ~[?:?]
	at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1061) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:1008) ~[?:?]
	at io.netty.handler.ssl.SslHandler.runAllDelegatedTasks(SslHandler.java:1528) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.runDelegatedTasks(SslHandler.java:1542) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1426) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1253) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1300) ~[bundleFile:4.1.63.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:508) ~[?:?]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447) ~[?:?]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [bundleFile:4.1.63.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.63.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.63.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[?:?]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[?:?]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[?:?]
	at java.lang.Thread.run(Thread.java:829) ~[?:?]
2021-05-03 11:08:43.686 [DEBUG] [l.nhc2.NikoHomeControlCommunication2] - connection lost
2021-05-03 11:08:43.688 [DEBUG] [nal.protocol.nhc2.NhcMqttConnection2] - stopping connection...

That’s not good. This may have to do with it: PR#2327.

I will see what I can do one of these days.

Thanks Mark, much appreciated.

Forgive my ignorance, but do you think there is anyway to keep M4 (with it’s fixed electricity monitoring) but rollback the Netty bundle? (As I say, please forgive me, but I don’t actually know what I’m talking about! :grimacing:)

It looks like the issue is not so much with netty, but with the upgrade of the hivemq bundle in the same PR. I have created an issue for it: #2346

It won’t be straightforward to solve this in an M4 install. The more likely workaround would be rolling back to M3 and insert the nikohomecontrol update in there. It may require quite a bit of effort to get it working though. I don’t have a version that was compiled before the hivemq upgrade. I would prefer to wait and see if we get anywhere with the issue resolution.