Giter Site home page Giter Site logo

Vmoto app about ha-super-soco-custom HOT 27 OPEN

darkner258 avatar darkner258 commented on August 19, 2024
Vmoto app

from ha-super-soco-custom.

Comments (27)

apbarratt avatar apbarratt commented on August 19, 2024 1

[sniggers] I just copy pasted and only just spotted the words "Wake up!" "The house is on fire and the cat's stuck in the dryer!" and now think someone had entirely too much fun writing those docs 😆

from ha-super-soco-custom.

drakhart avatar drakhart commented on August 19, 2024 1

And replying to the original question: I still need to reverse engineer (fancy words for peeping the code and API requests) the new Vmoto app to see if it really has any important difference with the "old" Vmoto Soco one, like different log in steps, target API, and so on.

Short answer: it could be compatible or not, I haven't checked yet. Honestly I'm getting a bit tired of these guys releasing new apps like there's no tomorrow.

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024 1

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

Aha, I was actually just on my way here to make a feature request as I just discovered the new app. Yes, the app works with the Super Soco App if your bike has the old style module using 3G, and it also works with the Vmoto app if you have the new module. But what I discovered yesterday is that there are actually two versions for the Vmoto module available on my iPhone at least, both seem to just be called Vmoto but the icon for the one I've been using to date says "VmotoSoco" and is black. I recently discovered that my data module's subscription had finally expired and that whilst the VmotoSoco app I was using was able to show when its inclusive subscription started, it provided no method of renewing it. The white icon Vmoto app on the other hand showed an expiry date and a few more data points that have proved interesting but most importantly I was able to renew my subscription.

Anyway, it's important to note that only one session at a time works with your account, but once you have your home assistant app set up the way you like it, you'll likely find yourself not wanting to open either of the official apps anyway :)

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

Oh that's curious. I wonder if there might be some additional configuration you might need to do. If you click Configure on the integration itself, what do you find?
Screenshot 2024-05-22 at 12 27 48
It's also important to remember you need to create automations to forward notifications to your phone, but that wouldn't explain the lack of data updates you've described.
I'd also wonder if your data subscription has expired, but if you're saying you do still see updates in the official app, that seems unlikely to be the issue here.

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

You can create an automation to handle notifications quite easily based on using the "last warning" sensor as a trigger. Here's the one I've written:

alias: Bike Alerts and Logging
description: Relay all bike alerts to Andy as critical.
trigger:
  - platform: state
    entity_id:
      - sensor.bike_last_warning
condition: []
action:
  - service: logbook.log
    data:
      name: "{{ trigger.to_state.attributes.title }}"
      message: "{{ trigger.to_state.attributes.message }}"
      entity_id: sensor.bike_last_warning
      domain: alert
  - choose:
      - conditions:
          - condition: template
            value_template: |-
              {{
                trigger.to_state.attributes.title == "burglar alarm"
                or
                trigger.to_state.attributes.title == "防盗报警"
              }}
        sequence:
          - service: notify.andy
            data:
              title: Bike Alarm
              message: The bike detected motion whilst locked... supposedly.
            enabled: false
        alias: Alarm
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.title ==
              trigger.from_state.attributes.title }}
        sequence:
          - service: notify.andy_with_critical
            data:
              title: "{{ trigger.to_state.attributes.title }}"
              message: "{{ trigger.to_state.attributes.message }}"
        alias: Other warnings that are different to last warning
mode: single

In this one I've separated the notifications up so I receive critical notifications for pretty much everything but the burglar alarm, which I found went off entirely too often, so I told it to use less critical notifications (although you'll be able to see I've just gone ahead and disabled alarm notifications all together for now). A light breeze sets mine off for example. One day I'll figure out how to turn down its sensitivity.

You'll also notice I detect that using both English and Chinese, because there have been the odd occasion when the Vmoto servers have started sending out messages in Chinese for some reason.

Now my notification part will look odd, that's because I created two notification groups so I don't have to fill in all the notification service data or remember the full entity ID for my phone every time I need it 😅
Here's what those groups look like in my config files:

notify:
  - platform: group
    name: andy
    services:
      - service: mobile_app_andy_barratt_s_iphone
  - platform: group
     name: andy_with_critical
     services:
      - service: andy
         data:
           data:
             push:
               sound:
                 name: default
                 critical: 1
                 volume: 0

It's important to note that the critical notification settings there are specific to iPhone/iPad. If you use Android, it's a different set of options so you'll need to tweak accordingly :)

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

Awesome, thanks! I'll try this out :)

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

@darkner258 How did you get on? :)
I thought I might try and add some docs in a PR some time soon with some example automation stuff like this :)

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

Well I have managed to get the non critical notifications working, but the critical ones are still not getting through. Below is my Yaml, do you see any mistakes there? I have simplified it a bit to include the notifications in the automation itself

alias: Bike Alerts and Logging
description: Relay all bike alerts to Andy as critical.
trigger:

  • platform: state
    entity_id:
    • sensor.super_soco_tcmax_last_warning
      condition: []
      action:
  • service: logbook.log
    data:
    name: "{{ trigger.to_state.attributes.title }}"
    message: "{{ trigger.to_state.attributes.message }}"
    entity_id: sensor.super_soco_tcmax_last_warning
    domain: alert
  • choose:
    • conditions:
      • condition: template
        value_template: |-
        {{
        trigger.to_state.attributes.title == "burglar alarm"
        or
        trigger.to_state.attributes.title == "防盗报警"
        }}
        sequence:
      • service: notify.mobile_app_astra_zeneca_id_294xa1
        metadata: {}
        data:
        message: Bike has moved slightly
        alias: Alarm
    • conditions:
      • condition: template
        value_template: >-
        {{ trigger.to_state.attributes.title ==
        trigger.from_state.attributes.title }}
        sequence:
      • service: notify.mobile_app_astra_zeneca_id_294xa1
        metadata: {}
        data:
        data:
        push:
        sound:
        name: default
        critical: 1
        volume: 1
        message: Bike has moved
        alias: Other warnings that are different to last warning
        mode: single

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

It's hard to tell with this formatting as the indentation is difficult to spot, if you wrap your code with a line of triple back ticks (i.e. ```) it'll be easier to read, but if I'm right in assuming your mobile phone is not an iPhone, I expect that's the primary issue we need to sort here as Android uses a different set of options.

The HomeAssistant docs example gives this for iPhone:

- service: notify.mobile_app_<your_device_id_here>
  data:
    title: "Wake up!"
    message: "The house is on fire and the cat's stuck in the dryer!"
    data:
      push:
        sound:
          name: "default"
          critical: 1
          volume: 1.0

Whereas the same for Android looks like this:

- service: notify.mobile_app_<your_device_id_here>
  data:
    title: "Wake up!"
    message: "The house is on fire and the cat's stuck in the dryer!"
    data:
      ttl: 0
      priority: high

The docs also give a few additional interesting options for Android, such as an "alarm stream" that can make your phone vibrate or make noises or even speak words even when the phone is set to stay silent.
https://companion.home-assistant.io/docs/notifications/critical-notifications/#:~:text=Critical%20alerts%20always%20appear%20at,notification%20rate%20limits%20as%20well.

Hope this comes in handy :)

from ha-super-soco-custom.

drakhart avatar drakhart commented on August 19, 2024

Just to add to this conversation and confirm Andy's notes on Android, this is my automation for relying alarms to my Android phone:

alias: Notify bike alerts
trigger:
  - platform: state
    entity_id: sensor.super_soco_tcmax_last_warning
    not_from:
      - unavailable
condition:
  - condition: state
    entity_id: device_tracker.super_soco_tcmax_location
    state: not_home
action:
  - service: notify.mobile_app_brian_phone
    data:
      title: >-
        {{ state_attr("sensor.super_soco_tcmax_last_warning", "title") |
        capitalize }} 🏍
      message: "{{ state_attr(\"sensor.super_soco_tcmax_last_warning\", \"message\") }}"
      data:
        ttl: 0
        priority: high
mode: single

The important bits here are ttl and priority, otherwise Home Assistant's app will delay the notifications anywhere from minutes to waiting until you wake your phone.

The location condition is also helpful so it doesn't pester me with endless alerts while the bike is parked at home, but nothing to do with Android vs iPhone.

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

It's hard to tell with this formatting as the indentation is difficult to spot, if you wrap your code with a line of triple back ticks (i.e. ```) it'll be easier to read, but if I'm right in assuming your mobile phone is not an iPhone, I expect that's the primary issue we need to sort here as Android uses a different set of options.

The HomeAssistant docs example gives this for iPhone:

- service: notify.mobile_app_<your_device_id_here>
  data:
    title: "Wake up!"
    message: "The house is on fire and the cat's stuck in the dryer!"
    data:
      push:
        sound:
          name: "default"
          critical: 1
          volume: 1.0

Whereas the same for Android looks like this:

- service: notify.mobile_app_<your_device_id_here>
  data:
    title: "Wake up!"
    message: "The house is on fire and the cat's stuck in the dryer!"
    data:
      ttl: 0
      priority: high

The docs also give a few additional interesting options for Android, such as an "alarm stream" that can make your phone vibrate or make noises or even speak words even when the phone is set to stay silent. https://companion.home-assistant.io/docs/notifications/critical-notifications/#:~:text=Critical%20alerts%20always%20appear%20at,notification%20rate%20limits%20as%20well.

Hope this comes in handy :)

Hey, so the code is below. My phone is iOS and I have run the notification part manually and it works. I have tried to set the alarm off on my bike but that did not trigger the notification :(

alias: Bike Alerts and Logging
description: Relay all bike alerts to Andy as critical.
trigger:
  - platform: state
    entity_id:
      - sensor.super_soco_tcmax_last_warning
condition: []
action:
  - service: logbook.log
    data:
      name: "{{ trigger.to_state.attributes.title }}"
      message: "{{ trigger.to_state.attributes.message }}"
      entity_id: sensor.super_soco_tcmax_last_warning
      domain: alert
  - choose:
      - conditions:
          - condition: template
            value_template: |-
              {{
                trigger.to_state.attributes.title == "burglar alarm"
                or
                trigger.to_state.attributes.title == "防盗报警"
              }}
        sequence:
          - service: notify.mobile_app_astra_zeneca_id_294xa1
            metadata: {}
            data:
              message: Bike has moved slightly
        alias: Alarm
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.title ==
              trigger.from_state.attributes.title }}
        sequence:
          - service: notify.mobile_app_astra_zeneca_id_294xa1
            metadata: {}
            data:
              data:
                push:
                  sound:
                    name: default
                    critical: 1
                    volume: 1
              message: Bike has moved
        alias: Other warnings that are different to last warning
mode: single

from ha-super-soco-custom.

drakhart avatar drakhart commented on August 19, 2024

Strange, that trigger should oh well, trigger the automation just fine.

Questions:

  • Is your "Native Push Notifications" switch set to on? This is needed in order for the bike to send the alerts to Vmoto servers.
  • If you check that automation traces around the time it should've been triggered, what do you see? Just in case any of those conditions is preventing the actions to execute.

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

Hey there, so there's good news and bad news. The good news is that HA does recognize the alert. The bad one is that nothing happened afterwards. I've attached screenshots from the traces to help debugging along with my yaml.
IMG_8369
IMG_8368
IMG_8367

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

But based on this, shouldn't the last condition be:
- conditions: - condition: template value_template: |- {{ trigger.to_state.attributes.title == "illegal displacement" }}

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

Sorry guys, work and family life is most distracting right now!
One thing I should have checked is that you've allowed Home Assistant to provide Critical Alerts.
On your iPhone, open Settings->Home Assistant->Notifications and you should see a screen like this one.
Notice that I've got Critical Alerts and Time-Sensitive Notifications turned on :)
image
I'm not sure if similar rules apply for Android.

I also don't know if Astra Zeneca might put restrictions on work devices, but hopefully not :)
Just in case the assets number is considered sensitive information, you might want to edit your posts above to hide your work device ID too so you don't end up in your employer's information security team's bad books, especially with all the conspiracy nut jobs out there who might target AZ's excellent work!

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

Ah fair enough, you got me 😅

This particular permission is for Home Assistant's critical alerts, so if you've not had other critical from HA it's still worth checking there specifically as I don't think Home Assistant is in the habit of requesting permission for critical notifications at onboarding time (though I may be mistaken about that!)

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

Ooo, I've never seen that particular one. I'm guessing that's one that appears when the bike is made to move when it's locked. I should probably update my own automation to make that one critical for me!

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

I must check actually, when I did that in the past the bike had a very annoying tendency to buck backwards and forwards, encouraging would be thieves to just drop it on the ground, I wonder if it still does it with my newer Vmoto ECU.

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

Curious, I think when I've set mine off deliberately I've done it by pressing the power button whilst it's armed.

from ha-super-soco-custom.

apbarratt avatar apbarratt commented on August 19, 2024

We really do need to find a way of collecting some data for all the different alerts and their translations. Partly so we can create better English translations, and partly so we can give @drakhart a proper Catalan translation, because I bet Vmoto are only giving him imperialist Spanish right now ;)

from ha-super-soco-custom.

darkner258 avatar darkner258 commented on August 19, 2024

Yeah, I have done this by pressing the button with the bike locked. What I've noticed is that I have to let the alarm finish screaming to get the notification :) If i disarm it before that, no data is sent

from ha-super-soco-custom.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.