If you use your original setup with the automation I posted, it will work for both google and gps
In my case, itâs a cat so I know where he is
I tried copy pasting your automation but keep getting
Message malformed: extra keys not allowed @ data[âconditionâ][0][âvalue_tempateâ]
The way I tried it is to create a new empty automation from the UI and then paste. Then I have to change it a bit as the yaml there is different then the one you pasted. Also tried to just copy your automation in automation.yaml, but also that gives errors. I am very unfamiliar with this so not sure what to change.
@petro
the command sometimes gives
`"log": "OUT 2021-12-06 14:17:12",`
or
`"log": "IN 2021-12-06 14:17:12",`
iâm interested in the words IN or OUT in that json, that means if the device is ON or OFF
how can i create the value template so it creates the word on/off ?
- name: GPS365_Online
value_template: "{{ (value[1:] | from_json)[0].log.split(' ')[0:1] }}"
that already gives me : ['OUT']
check it against the word out then using ==
like this?
- name: GPS365_Online
#value_template: "{{ (value[1:] | from_json)[0].log.split(' ')[0:1] }}"
value_template: >
{% (value[1:] | from_json)[0].log.split(' ')[0:1] == ['OUT'] %}
off
{% else %}
on
{% endif %}
gives me template syntax error :â
crap, forgot the if word
youâre missing if, and you added brackets around out.
@petro
that automation you posted earier; for you its working?
it gives errors for me:
- alias: GPS365_Pepe
initial_state: 'on'
mode: parallel
trigger:
- platform: state
entity_id:
- sensor.gps365_google
- sensor.gps365_gps
variables:
coords: >
{{ trigger.to_state.state.split(',') | list if trigger is not none and trigger.to_state is defined else none }}
condition:
- condition: template
value_tempate: "{{ coords | length == 2 }}"
action:
- service: device_tracker.see
data:
dev_id: "{{ trigger.to_state.entity_id.replace('.','_') }}"
gps: "{{ coords }}"
2021-12-06 16:12:24 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [value_tempate] is an invalid option for [automation]. Check: automation->condition->0->value_tempate. (See /config/configuration.yaml, line 100).
are you using it?
Iâm not, I made the automation on the fly. But value_tempate just has a spelling error, should be value_template
omg , thnx
i really need to read
I put the typo it in . not your fault
still struggling with that âoutâ word
value_template: "{{ (value[1:] | from_json)[0].log.split(' ')[0:1] }}"
gives me in sensor : [âOUTâ]
but below are not correct
value_template: >
{% if (value[1:] | from_json)[0].log.split(' ')[0:1] == 'OUT' %}
off
{% else %}
on
{% endif %}
or
value_template: >
{% if (value[1:] | from_json)[0].log.split(' ')[0:1] == "OUT" %}
off
{% else %}
on
{% endif %}
or
value_template: >
{% if (value[1:] | from_json)[0].log.split(' ')[0:1] == OUT %}
off
{% else %}
on
{% endif %}
it should give me âoffâ , but gives me âonâ instead
i think its because of the lines:
value_template: "{{ (value[1:] | from_json)[0].log.split(' ')[0:1] }}"
gives me in editor :
I just noticed youâre slicing too, just take the first item.
(value[1:] | from_json)[0].log.split(' ')[0] == 'OUT'
that was it
thnx again!
@petro, you helped me a while ago with these sensors below
But since i have enabled rest in my config, i have slowdown/timeouts⌠i think its because of the rest:
2021-12-28 16:35:58 WARNING (MainThread) [homeassistant.setup] Setup of rest is taking over 10 seconds.
On the info, i see the startup for rest takes sometimes 20 secondsâŚ
Am i right, that below configuration, there are 7 sensors, so is the resource is excuted 7 times? Or just once?
I use google assistant a lot, and sometimes when i turn on a light, it takes a while, maybe its because the rest are commands are fired at that time and some timeout is occuring?
rest:
- resource: !secret gps365_get_status_resource-
scan_interval: 60
sensor:
- name: GPS365_Google
value_template: "{{ (value[1:] | from_json)[0].google }}"
- name: Gps365_LAT
value_template: "{{ (value[1:] | from_json)[0].gps.split(',')[5] }}"
- name: Gps365_LON
value_template: "{{ (value[1:] | from_json)[0].gps.split(',')[6] }}"
- name: GPS365_Battery
value_template: "{{ (value[1:] | from_json)[0].bat }}"
- name: GPS365_Update
value_template: "{{ (value[1:] | from_json)[0].sec }}"
- name: GPS365_On_off
value_template: >
{% if (value[1:] | from_json)[0].log.split(' ')[0] == 'OUT' %}
off
{% else %}
on
{% endif %}
Guys, anyone using the 365gps ? since a week when running command below, i always get:
EDIT:
Found it, this â&ver=4.10â needs now to be added to the string âŚ
thanks for the question and the answer! didnt realize yet that it stopped working.
How did you figure out that you needed to add â&ver=4.10â to it?
I use âfiddlerâ to capture the http(s) please proxy traffic from the android APK app, there you can see the traffic what the app doesâŚ
Thatâs how I figured out all other commands like remote turn on/off , change interval time âŚ
Verry cool app, also usefull for other apps to integrtate commands in HA