HITMIK
(HITMIK)
April 11, 2021, 6:51am
74
I use a NFC tag. The tag is located under the doorbell cover in front of the door. I scan the tag and automation according to the lock status (locked, unlocked) triggered a notification.
Locked - to unlock? (use script.nuki_open)
Unlocked - open door / lock? (use script.nuki_open / script.nuki_lock
I use script.nuki_unlock for example, in the morning when I get up and turn on the light in the bathroom (automation with google mini play radio and read news, calendar etc.) when I wash
Sorry for my English
1 Like
Joerg
April 13, 2021, 3:34pm
75
Hi, I wondered what the +11*60
are for when fetching the timestamp:
{{ (as_timestamp(states.sensor.nuki_stav_zamku.attributes.timestamp)+11*60) | timestamp_custom("%H:%M %d/%m") }}
I removed it because it always showed a wrong time here.
HITMIK
(HITMIK)
April 14, 2021, 3:43pm
76
You can delete. I have problem with difference time.
1 Like
cavaco
(André Cavaco)
April 20, 2021, 12:26pm
77
@HITMIK im trying to put your code to work , but alway i have unknown , i have only changed the IP:PORT , and the TOKEN=mytoken , the rest i left like it was , but still no luck , i have the http api enabled , and im using the token the app showed there ,
can u help me figure out what is wrong ??
if i use the HA integration for NUKi , its working in can lock or unlock , but it doesnt show the bat or door open …
can someone help me out ??
Joerg
April 20, 2021, 1:24pm
78
We might can help if you let us see what you’ve put in sensors.yaml
cavaco
(André Cavaco)
April 20, 2021, 1:45pm
79
Here it is
if changed a few stuff , now i get , some sensors working , but the one i wanted nothing , the bat , here is the sensors.yaml , thanks for the help
- platform: rest
scan_interval: 13 # for constant polling to avoid draining the batteries too fast.(?)
resource: http://xx.xx.xx.XXX:XXXX/list?token=XXXXXXXX # cache in bridge
name: "NUKI Porta Estado"
value_template: "{{ value_json[0]['lastKnownState']['stateName'] }}"
json_attributes_path: "$[0].lastKnownState"
json_attributes:
- batteryCritical
- batteryChargeState
- timestamp
- platform: rest
scan_interval: 300
resource: http://xxx.xxx.xxx:xxxx/info?token=xxxxxxx # info devices and bridge
name: "NUKI Porta RSS"
value_template: "{{ value_json['scanResults'][0]['paired'] }}"
json_attributes_path: "$.scanResults[0]"
json_attributes:
- rssi
- platform: template
sensors:
nuki_porta_battery:
friendly_name: "NUKI Porta Battery"
value_template: "{{ state_attr('sensor.nuki_porta_estado', 'batteryChargeState') }}"
unit_of_measurement: '%'
- platform: template
sensors:
nuki_porta_rssi:
friendly_name: "NUKI Porta rss"
value_template: "{{ state_attr('sensor.nuki_porta_rss', 'rssi') }}"
unit_of_measurement: 'dB'
- platform: template
sensors:
last_motion_nuki_porta:
friendly_name: Last Action
value_template: >-
{{ (as_timestamp(states.sensor.nuki_porta_estado.attributes.timestamp)+11*60) | timestamp_custom("%H:%M %d/%m") }}
- platform: template
sensors:
nuki_porta_net:
friendly_name: "NUKI Network"
value_template: >-
{% if is_state('sensor.nuki_porta_rss','False') %}
Not connected
{% elif is_state('sensor.nuki_porta_rss','True') %}
Connected
{% else %}
Unknown
{% endif %}
icon_template: >-
{% if is_state('sensor.nuki_porta_rss','False') %}
mdi:server-network-off
{% elif is_state('sensor.nuki_porta_rss','True') %}
mdi:server-network
{% else %}
mdi:wifi-strength-alert-outline
{% endif %}
cavaco
(André Cavaco)
April 20, 2021, 2:31pm
80
These dont seem to work as well , Iv only change the IP:PORT , and in the END the TOKEN , scripts dont do nothing !!!
XX.xxx.xxx.xx:xxxx/lockAction?nukiId=IDNUKISMARTLOCK&deviceType=0&action=1&token=XXXXXX’
do i need to change anything else here ??
Joerg
April 20, 2021, 3:01pm
82
Okay, once again without the IPs and tokens
I can’t find the errors in your definition of sensors, this works for me:
# NUKI Lock
- platform: rest
scan_interval: 13 # for constant polling to avoid draining the batteries too fast.(?)
resource: http://network/list?token=my_token # cache in bridge
name: "NUKI Lockstatus"
value_template: "{{ value_json[0]['lastKnownState']['stateName'] }}"
json_attributes_path: "$[0].lastKnownState"
json_attributes:
- batteryCritical
- batteryChargeState
- timestamp
- doorsensorStateName
- platform: rest
scan_interval: 300
resource: http://network:8081/info?token=my_token # info devices and bridge
name: "NUKI Connection"
value_template: "{{ value_json['scanResults'][0]['paired'] }}"
json_attributes_path: "$.scanResults[0]"
json_attributes:
- rssi
- platform: template
sensors:
nuki_batterie:
friendly_name: "NUKI Status Battery"
value_template: "{{ state_attr('sensor.nuki_Lockstatus', 'batteryChargeState') }}"
unit_of_measurement: '%'
- platform: template
sensors:
nuki_rssi:
friendly_name: "NUKI Wifi Status"
value_template: "{{ state_attr('sensor.nuki_Connection', 'rssi') }}"
unit_of_measurement: 'dB'
- platform: template
sensors:
last_motion_nuki:
friendly_name: "Last Action"
value_template: >-
{{ (as_timestamp(states.sensor.nuki_Lockstatus.attributes.timestamp)) | timestamp_custom("%H:%M %d/%m") }}
- platform: template
sensors:
nuki_status_door:
friendly_name: "NUKI Status Door Sensor"
value_template: "{{ state_attr('sensor.nuki_Lockstatus', 'doorsensorStateName') }}"
- platform: template
sensors:
nuki_netzwerkstatus:
friendly_name: "NUKI Status Network"
value_template: >-
{% if is_state('sensor.nuki_Connection','False') %}
not connected
{% elif is_state('sensor.nuki_Connection','True') %}
connected
{% else %}
unknown
{% endif %}
icon_template: >-
{% if is_state('sensor.nuki_Connection','False') %}
mdi:server-network-off
{% elif is_state('sensor.nuki_Connection','True') %}
mdi:server-network
{% else %}
mdi:wifi-strength-alert-outline
{% endif %}
which gives me this:
cavaco
(André Cavaco)
April 20, 2021, 3:15pm
83
@Joerg Thanks for your help and info , dont see nothing different , but my battery info says unknown , quick question , do you have the Power Pack , or just standard Batteries ???
Thank you
Joerg
April 20, 2021, 3:37pm
84
Ususally I use Energizer Ultimate Lithium batteries, but at the moment standard batteries are used.
Have you removed the HA NUKI integration?
cavaco
(André Cavaco)
April 20, 2021, 3:48pm
85
No i have not removed the HA NUKI Integration, im using it to the unlock and lock , since the scripts are not working , do i need to remove it ??
cavaco
(André Cavaco)
April 20, 2021, 3:48pm
86
with HA Integration its like this
cavaco
(André Cavaco)
April 20, 2021, 3:50pm
87
i see u using port 8081 , im going to try to change my port 8080 to that one !!!
Joerg
April 20, 2021, 3:56pm
88
You need to change it to the port you’ve setup in the App, right?
cavaco
(André Cavaco)
April 20, 2021, 3:57pm
89
yes by default it has 8080 , not i changed in the app to 8081 , and changed the code , but so far its the same … baterry info doesnt work for me !!! its very strange because in the app i can see the batteries at 98% !!!
Joerg
April 20, 2021, 4:11pm
90
You need to exchange this
HITMIK:
IDNUKISMARTLOCK
in
nuki_unlock: "curl -s 'IP:PORT/lockAction?nukiId=IDNUKISMARTLOCK&deviceType=0&action=1&token=TOKEN'"
to the Smart Lock ID of your lock in order to get the scripts working.
Go to the Bridge and choose the Lock, there is the ID of the Lock.
To be honest: I have no idea how to get the ID if no Bridge ist around.
In the App → Verbindungsstatus (connection status) - tipp on the Lock → there is the ID
cavaco
(André Cavaco)
April 20, 2021, 4:15pm
91
ok i will try that …
my connection to the bridge with token , reports thar battery critical is yes , but iv changed the batteries and in the app it says 100% , and it doesnt show any field for batterychargestatus , so maybe that is the problem , what firmware does your bridge have ??
cavaco
(André Cavaco)
April 20, 2021, 4:25pm
93
im on 2.4.21 , doing a call to update firmware to see - fwupdate?token=
cavaco
(André Cavaco)
April 20, 2021, 4:35pm
94
@Joerg , u send me the firmware of the lock ?? or the bridge , im on the lock on 2.10.8 , but on the bridge its on 2.4.21 , and after the comand to update it stayed in the same firmware , and the batterycritical : true continues , maybe i have to post in the nuki forum to see if its a bad bridge !!