Can't see energenie items

I can’t get energenie items to show. I am also confused by the configuration instructions. In the example, it first uses pms1 as the ID , and then supposedly for the same device bridge1. I have tried all combinations, but it is of no help. Someone please tell me what I am doing wrong.

I am able to control the energenie through the web interface on the configured ip and with the password. I can’t see any related entry in the openhab log other than that it loaded the model energenie.items.

I am using Openhab2. I have installed the energenie binding from paper UI. Then I defined a config file and an items file for it as such:

energenie.cfg

pms1.host=192.168.189.36
pms1.password=secret

energenie.items

group gEnergenie
switch Amplifier_Power (gEnergenie) { energenie="pms1;4" } 
switch Tv_Power (gEnergenie) { energenie="pms1;1" }
switch Sonos_Connect_Power (gEnergenie) { energenie="pms1;3" }
switch Sonos_playbar_Power (gEnergenie) { energenie="pms1;2" }

You are missing sitemap entries like

Switch item=Amplifier_Power
Switch item=Tv_Power
Switch item=Sonos_Connect_Power
Switch item=Sonos_playbar_Power

Description for switches on a sitemap can be found at
http://docs.openhab.org/configuration/sitemaps.html#element-type-switch

I’m a bit stuck

I have made the cfg file and .items file as above. they are in their respective directories, services and items.

Upon executing the following rule

sendCommand(Sonos_Connect_Power, ON)

I get the following error in the log

The name 'Sonos_Connect_power' cannot be resolved to an item or type.

There are no entries in the log pointing out any problems with the .items file. Every time I save the .items file, it shows a log entry that it has processed the file.

Also, when I try to operate the energenie from a sitemap (with the switches defined as in your suggestion), it won’t do anything and also will throw a log entry about an unknown item.

I have checked the energenie IP address and password, they correspond with the settings in the .cfg file.

What can cause Openhab not to recognize the contained items?

Ok f… me, I fixed it. It was an error in the declaration of the item type. I wrote “switch” I should have written “Switch” capital S. sheesh…

Hi,
The best tool for syntax checking of the configuration files is SmartHome Designer. A case like yours can be easily avoided using the designer.
You can find the installation instructions here.
You will see that it eases the process a lot.

I am actually using visual studio with the plugin. It turned blue as soon as I changed it. But since I just started using it today, the white text didn’t ring any bells before…

The Visual Studio Code plugin is still in it’s infancy, it will hopefully have the capabilities of Smarthome Designer in the near future.
It’s better to use the Smarthome Designer, because it will point you the problems, Visual Studio Code will only highlight but will not point the exact wrong syntax (at least for now).
So, my recommendation is to use the designer , especially for beginners.

And my first working rule. When my Sonos:Connect is playing, turn on the amplifier (has a 12v trigger, 12v charger connected to energenie). When it stops playing for at least 2 minutes, turn off the amplifier.

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openhab.model.script.actions.Timer
var Timer music_timer = null

rule "music detection"

when
Item SonosWohnzimmer_State changed
then

if(SonosWohnzimmer_State.state == "PLAYING") {
    sendCommand(Amplifier_Power, ON)
    music_timer.cancel
    music_timer = null
    logInfo("Sonos","Play detected, power on, timer cancelled")
    }
else if (music_timer == null){
    logInfo("Sonos","Pause detected, timer set to expire in 2 minutes, then  power off")
    music_timer = createTimer(now.plusMinutes(2)) [|
        sendCommand(Amplifier_Power,OFF)
        music_timer = null
        logInfo("Sonos","timer was triggered")
        ]
    }

end
1 Like

Tried Eclipse Smarthome Designer. I see it does the same kind of checks that would otherwise pop up in the log. However, it doesn’t catch a non-valid type declaration either. Just syntax highlighting that gives a clue. The log also doesn’t give any hints towards this kind of error.

Hi together
I had install the energenie Binding addon. after add the .cfg file,.items and make Switch`s on the Sitemap.
When I restart my openhab raspberry, they will worke one time, after few minutes i will become:
[ERROR] [.energenie.internal.EnergenieBinding] - Response transformation throws exception

java.lang.ArrayIndexOutOfBoundsException: 2

at org.openhab.binding.energenie.internal.EnergenieBinding.processSwitchItem(EnergenieBinding.java:247) [224:org.openhab.binding.energenie:1.13.0]

at org.openhab.binding.energenie.internal.EnergenieBinding.execute(EnergenieBinding.java:121) [224:org.openhab.binding.energenie:1.13.0]

at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [216:org.openhab.core.compat1x:2.4.0]

at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [216:org.openhab.core.compat1x:2.4.0]

can somwhere help me?

regards

hi,
i had make some error in my sitemap, now they will work.

regards