HABApp - Easy automation with openHAB

@Dibbler42:
Could you please confirm that this fixes your issues?

First i have to figure out how to switch to the dev branch :slight_smile:

Just download the dev source code from github and replace the existing source code in /opt/habapp/lib/python3.X/site-packages/HABApp

Seems that this fixed the problem. Now i get no error messages.

Hmm unfortunately no rules are loaded

I still havenā€™t looked into HABApp item creation but I probably should. For my ā€playersā€ like AppleTV, Chromecast, Squeezeboxes I made items file for each by copy, paste & edit back and forth until they where equal enough to handle them by name.

That was something I used already in DSL rules but using HABApp and patterns to create the items sound much nicer!

Hm, no error in the logs and nothing gets loaded? :thinking:
That sounds really strange ā€¦ .
Are you sure HABApp is starting without errors and the config points to the correct folders?

Maybe one of the mods can move the troubleshooting to a new thread or can you create one?

I donā€™t create openHAB items programatically any more. Itā€™s either *.items files or textual thing config.
Both give me the benefit that it is possible to quickly check the created items and look up names.
I am currently slowly moving to the latter, because with my z-wave devices I get to have the same parameters for every device, even when I add new devices.

I do however create items solely in HABApp for usage in rules (e.g. an item that is True/False wether it is dark). That way I can use the information in different rules.

I think i found the error. There was a wrong path. After chaning it, it worked again. I did not recognize that i changed something.

How do you create pure HABApp items? BaseValueItem does not seem to have a create method

Here is an example. Itā€™s nice because HABApp doesnā€™t have to push the status to OpenHAB and it makes it really easy to share stuff between rules.

However, I mostly use the MultiModeIItem

Hmmm just saw this strage behavior with development branch

18:37:11.363 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 2.1
18:37:21.898 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 2.1 to NULL
18:37:32.392 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 6.2
18:37:42.892 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 6.2 to NULL
18:37:53.391 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 3.6
18:38:03.890 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 3.6 to NULL
18:38:14.393 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 3.6
18:38:24.895 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 3.6 to NULL
18:38:35.396 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 4.2
18:38:45.899 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 4.2 to 3.9
18:38:56.396 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 3.9 to NULL
18:39:06.900 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 2.1
18:39:17.394 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 2.1 to NULL
18:39:27.898 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 3.2
18:39:38.400 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 3.2 to NULL
18:39:48.897 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 6.0
18:39:59.407 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 6.0 to NULL
18:40:09.911 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 2.1
18:40:20.423 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from 2.1 to NULL
18:40:30.920 [INFO ] [smarthome.event.ItemStateChangedEvent] - Item 'ZO_OH_HABApp_Ping' changed from NULL to 4.8

@Spaceman_Spiff
Hello Seb. Thank you so much for creating this library. I just tried out HABApp, and my first simple rule to turn on / off a light switch worked flawlessly. I currently have quite a lot of OH rules and library code in Jython, and I am exploring whether it is feasible to move over to HABApp. I love the ability to work with the latest Python and the isolation away from the OH runtime.

Iā€™ve two questions so far:

  1. Is it possible to get a dump of all items including all the meta data? My library code uses the list of items and its meta data to build up the object model?
  2. Why is HABApp.openhab.interface.get_item() limits to a single metadata name? Many of my items have multiple metadata entries?

Thank you,

Seb, I found that HABApp.core.Items.get_all_item_name() seems to return all item names, but for thing in HABApp.core.Items.get_all_items(): only returns a few. Is it a known bug?

Hm, really strange. Are there other rules that interact with your ping item?
Currently I canā€™t seem to reproduce it.

Edit:
I pushed some minor changes to the dev branch. It shouldnā€™t matter if there are other things happening with the ping item. Could you please check it out?

The name space is comma separated. It is supposed to be a regex or support wildcards, but that has been broken in OH2.

This definitely works.

Yes - it is possible. I think somewhere in the thread are even some code snippets for it.

But Iā€™ll recommend what I always do:
If you name your item properly itā€™s way easier and more consistent to access it by item name.
And since you can pass in arguments into the class you can create multiple class dynamically e.g. from a parameter file or a static list/dict.

There is no benefit of going through all the pain with metadata :wink:
Also check out textual thing config to quickly set up a good naming scheme.

For future flexibility, I still prefer to have everything in the .items file. It leaves room for the items to be used by rules written in other code. The other dimension is the migration. Most of us already have .items file with potentially metadata entries. Logically we would want to migrate to HABapp gradually by migrating the code first, then tackle the .items file later. I hope that explains where I come from :). Hereā€™s one of my sample item with multiple metadata entries.

Switch FF_Foyer_LightSwitch "Foyer Light" (gWallSwitch, gLightSwitch, gFirstFloorLightSwitch)
  { channel="zwave:device:9e4ce05e:node2:switch_binary",                        
    turnOff="SF_Lobby_LightSwitch",                                             
    disableMotionTriggeringIfOtherLightIsOn="FF_Office_LightSwitch",            
    noPrematureTurnOffTimeRange="0-23:59",                                      
    durationInMinutes="5"} 

Dimmer SF_Lobby_LightSwitch "Lobby Light"                                       
  (gWallSwitch, gLightSwitch, gSecondFloorLightSwitch)                          
  { channel="zwave:device:9e4ce05e:node10:switch_dimmer",                       
    turnOff="FF_Foyer_LightSwitch",                                             
    dimmable="true" [level=2, timeRanges="20-8"],                               
    durationInMinutes="2" } 

Above, I have a naming scheme to group items into zones, but meta data is still needed to specify additional behaviors.

Thanks,

I understand where you coming from and understand that you might keep the metadata if you want to migrate to another rule engine.
Itā€™s just way easier to use parameter files (that way you have a central place, too) to set up rules and/or pass the arguments into the rule class.

What you can do is keep the metadata and try out the HABApp way, that way itā€™s no harm.

Good news everyone!

I just released a new version which contains some small fixes

0.17.1

  • Increase http buffer to 512k (now allows 383k image size)
  • reworked ping handling
  • Updated requirements

Btw:
I think I should create a new thread for every major release so the discussions about problems are focused there. What do you think?

Hey Sebastian,

i just reinstalled HABApp with 0.17.1 on OH3 #2061 and i see very high ping times. Around 500ms. I am sure that a saw time around 5ms with 0.16.x and other OH3 build.

As far as i remember you opened an issue on that.

Yes, here it is.

I changed the ping time to total round trip time, thatā€™s why you only see the high ping time now.