Hi Rich,
What a mess. I sucessfully setup some items that use jsonpath to transform as you suggest but OH complains about it in the logs endlessly. It doesn’t like the NULL. It also seems to have a hard time putting it into mapdb or mysql persistence and throws errors about that and on startup doesn’t restore.
If that wasn’t bad enough, you can’t map a command because json has a “:” in it and you can’t put that in the item’s MQTT statement. I found that I could replace the mqtt transform with a map and was going to create custom map files to have the full on={“power”:“ON”} This even worked in my mqtt pub/sub tests.
Next I tried to setup my sitemap to have a switch item with mappings for cool, heat, dry. Well, if the mode string had null still in it, basicUI would just break and show a 500 with a bunch of junk. If you published data to the topic with anything other than null it would be fine.
So, I have spent 5 hours fighting with this and am about ready to loose my mind. Some of the various errors and warnings I get:
2017-06-02 19:57:51.461 [ItemStateChangedEvent ] - MBACMode changed from NULL to null
2017-06-02 19:57:51.476 [ItemStateChangedEvent ] - MBACFan changed from NULL to null
2017-06-02 19:57:51.562 [ItemStateChangedEvent ] - MBACVane changed from NULL to null
2017-06-02 19:59:57.532 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'default.items’
2017-06-02 19:59:57.833 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACPower’
2017-06-02 19:59:57.835 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACTemp’
2017-06-02 19:59:57.874 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACPower’
2017-06-02 19:59:57.876 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACTemp’
2017-06-02 19:59:57.886 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACPower’
2017-06-02 19:59:57.887 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACTemp’
2017-06-02 19:59:57.926 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACPower’
2017-06-02 19:59:57.928 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACTemp’
2017-06-02 19:59:57.971 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'MBACPower’
2017-06-02 19:59:57.974 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for ‘MBACTemp’
2017-06-02 19:56:55.673 [ERROR] [.eclipse.smarthome.model.persistence] - [org.eclipse.smarthome.model.persistence.manager(106)] The unsetModelRepository method has thrown an exception
java.lang.NullPointerException
at org.eclipse.smarthome.model.persistence.internal.PersistenceModelManager.unsetModelRepository(PersistenceModelManager.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_131]
…
2017-06-02 19:43:27.329 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener ‘[org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl@50867ec8, MBACFan, null]’ about state update of item java.lang.NullPointerException: {}