[SOLVED] Help with sending Command

@kjoglums : I’m eager to have a PR toward this binding. It’s important to enhance it with the fruits of your work.
Please, note that for each car, VOC service identifies available features, these are captured when discovering the car :

Also see that the honk/blink command is insufficient as is for the OpenHab binding, as location (long,lat) apparently is required included, although, I can not foresee this being a relevant command for me.

IIRW the binding sends honk/blink along with car location (lat,long), so it should work fine.

A PR is then created:

So, based on the PR, the following actions/commands are now available:
heaterStartCommand()
heaterStopCommand()
preclimatizationStartCommand()
preclimatizationStopCommand()
openCarCommand()
closeCarCommand()
engineStartCommand()
honkBlinkCommand()

And an example of preclimatizationStartCommand successfully used in script/rule:

rule "VOC Heater On"
    when
        Item VOC_HeaterStart changed to ON
    then
        val actions = getActions("volvooncall", "volvooncall:vehicle:VIN_NUMBER")
        if(actions===null) {
            logWarn("VOC", "Actions not Found")
            return
        }
        else {
        logWarn("Volvo", "VOC - Actions")
        actions.preclimatizationStartCommand()
        }
        VOC_HeaterStart.sendCommand(OFF)
end
1 Like

Awesome!
I would be happy to test it with my XC60 2016/2017

Ongoing PR, so there will be (hopefully) an official release of a new binding.

1 Like

Thanks a lot for your efforts.
Is in your version the Heater state correctly reflected?

See:

Well, my car is preclimatizationSupported rather than remoteHeaterSupported (as identified under vehicle properties under Things in Paper UI) and I use the new commands (preclimatizationStart/Stop), so I ignore/don’t use VolvoV90XCOtherRemoteHeater. Not sure why it is identified as part of my vehicle when it is not remoteHeaterSupported.

My Car supports the remoteHeater according to PaperUI (and works well with voc python script from @molobrakos)
I still have the issue that the state is not reflected correctly through the binding:
2019-10-31 16:35:10.097 [vent.ItemStateChangedEvent] - CarHeater changed from OFF to NULL

So, your Car supports preclimatization and provides the current state through a channel properly?
Did you change the binding to make it work that way?
Would this be applicable to my remoteHeater state issue as well?

My focus for this binding PR has been to enable OpenHab control of preclimatizationSupported vehicle (my V90 CC), thus implementing commands for preclimatization. Further, I have identified an attribute “{}” which apparently is required implemented as part of commands to actually get commands passed through the vocapi, both for heaterSupported and preclimatiationSupported vehicles.

In my case, I haven´t been using a state change on the OpenHab side to get acknowledgement of commands/state, just using VOC app to verify commands are getting through. In my case I want to use time cron rules to start preclimatization based on certain conditions, close doors when going to bed etc.

Haven´t actually looked into the channel/item details of remote heater. Thus, not sure if it is retrieved as an actual item from VOC, or if it is generated as part of the binding. In your case, it might be you get the correct state of your remote heater if you manage to actually get heater commands through using OpenHab (although, that is just a wild assumption).

Alright, Thanks for the detailed response.
Anyway, your modifications will help to get the remoteHeater to work sometime as well.
I will just be a little more patient :smiley:

@NCO and @noppes123

Just for reference: The PR has been approved, and has been merged into master branch. Jar file available to download:

https://ci.openhab.org/job/openHAB2-Bundles/org.openhab.addons.bundles%24org.openhab.binding.volvooncall/ws/target/

2 Likes

Thanks.
I will try it right away!
:blush::+1:t2:

Hi Stian,

it seems to work (both heater and (un)lock)

However, I get an error when unlocking the car:

URL https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles/Car_VIN_Number/unlock returned The service was unable to start

This leads to an unlock of the trunk, which - if opened - will unlock all other doors.
Consequently the car thinks, that it’s still locked (if the trunk stays shut) and returns
The car xxx is already locked
It will be locked though.

That’s ok for me as it is working.
I just wanted to share these results for a future update.

Doesn’t anyone esle have this issue?
The current state of the Heater always drops back to NULL (even on the new Milestone 2.5M5

I do have this dropping back to NULL too. I have a Volvo V90.
Using OH 2.5 with the bundled binding

I have still the same issue and need to request the state of the heater using the VOC script by @molobrakos

However, I would prefer to use the binding only.

By the way, additional information is provided by my car which is not available on the binding yet.:
Tire air pressure
Light bulb failure
Brake fluid too low warning

Hello, I have a XC90 but cannot get the preclimatizationStartCommand() to work, although preclimatization is flagged “true” in the car properties in OpenHAB. I’m running OpenHAB 2.5 with bundled VoC binding. Is there an updated binding available for download? The above link doesn’t work for me. Or is there any other workaround I can use? Thanks a lot in advance for some help to get the preclimatizationStartCommand() running.

It’s probably not of much help, but the heater works for my V90 (model year 2017). remoteHeater is not supported but preclimatization is.

This little example turns the heater on or off:

from core.rules import rule
from core.triggers import when
from core.jsr223.scope import actions

@rule("Switch Preclimatization", description="Turn the Volvo pre-climatization on or off", tags=["car"])
@when("Item VoC_Heater changed")
def volvoHeater(event):
    action = actions.get("volvooncall","volvooncall:vehicle:v90:V90")
    if action is None:
        volvoHeater.log.info("Actions not found (check thing ID)")
        return
    volvoHeater.log.info("Calling pre-climatization action with [{}] status".format(event.itemState))
    if event.itemState == ON:
        action.preclimatizationStartCommand()
    elif event.itemState == OFF:
        action.preclimatizationStopCommand()
    else:
        volvoHeater.log.warn("Inavlid state for VoC preclimatization action")

This is shown in the openhab.log:

[INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/personal/volvo_heater.py'
[INFO ] [ation.jython.Switch Preclimatization] - Calling preclimatization action with [ON] status
[DEBUG] [l.internal.action.VolvoOnCallActions] - preclimatizationStartCommand called
[DEBUG] [nal.handler.VolvoOnCallBridgeHandler] - Post URL: https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles/**REDACTED**/preclimatization/start Attributes {content-type=application/json, x-os-version=22, x-os-type=Android, cache-control=no-cache, Authorization=Basic ...
[DEBUG] [call.internal.handler.VehicleHandler] - Trips discovered : 1
[DEBUG] [call.internal.handler.VehicleHandler] - Trip found 2020-02-07T14:11:09.000+0100
[DEBUG] [nal.handler.VolvoOnCallBridgeHandler] - Action status : SUCCESSFULL for vehicle : **REDACTED**.
[INFO ] [ation.jython.Switch Preclimatization] - Calling preclimatization action with [OFF] status
[DEBUG] [l.internal.action.VolvoOnCallActions] - preclimatizationStopCommand called
[DEBUG] [nal.handler.VolvoOnCallBridgeHandler] - Post URL: https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles/**REDACTED**/preclimatization/stop Attributes {content-type=application/json, x-os-version=22, x-os-type=Android, cache-control=no-cache, Authorization=Basic ...
[DEBUG] [nal.handler.VolvoOnCallBridgeHandler] - Action status : SUCCESSFULL for vehicle : **REDACTED**.

This is on OH 2.5.0 release version with the following binding:

275 │ Active │  80 │ 2.5.0    │ openHAB Add-ons :: Bundles :: Volvo On Call Binding

You can turn on DEBUG logging and see if that gives any clues.

Hi noppes123, Thanks a lot, will try it out immediately. Could you please give me a hint on how to exactly fill out that specific line:

action = actions.get("volvooncall","volvooncall:vehicle:v90:V90")

I assume, that the first “v90” entry represents the Car-ID, but what exactly do I have to enter for the second “V90” entry?

It’s crazy, but I always get the following message in the log:

2020-02-07 00:07:58.807 [WARN ] [call.internal.handler.VehicleHandler] - The car XYZ111111111 does not support remoteHeater

Any idea?

How are you trying to activate preclimatization? To me it seems like your car is preclimatization supported, but you try to activate remoteHeater (which is only supported by remoteHeater supported vehicles) as @noppes123 points out. You should be running an action script to operate preclimatiation. A rule example working for me is shown below (my Volvo thing is created in PaperUI).

rule "VOC Heater On"
    when
        Item VOC_HeaterStart changed to ON
    then
        val actions = getActions("volvooncall", "volvooncall:vehicle:CAR_VIN_NUMBER")
        if(actions===null) {
            logWarn("VOC", "Actions not Found")
            return
        }
        else {
        logWarn("Volvo", "VOC - Actions")
        actions.preclimatizationStartCommand()
        }
        VOC_HeaterStart.sendCommand(OFF)
end