DNS IP state to text

Hello,
I’ve installed DNS IP integration and I need to extract the current IP as text to use a REST Api to update my DNS record. I failed to get the IP as text in my payload:
If I use ip: myip.state I got "rrset_values": ["myip.state"] } in the payload.
If I use ip: {{myip.state}} I got "rrset_values": ["{\'[object Object]\': None}"]
What is the correct syntax to get the current IP as text in an automation?

{{.states(‘sensor.myip’) }}

Still the same. I’ve tried
{{.states('sensor.myip')}}
{{states('sensor.myip')}}
{{.states("sensor.myip")}}

Always get the same ["{\'[object Object]\': None}"]in my payload

Have you verified the value in Developer Tools → states?
Have you tested your template in Developer Tools → Templates?

Now, I have a question. What is the use case for the integration?
I can’t imagine why I need to know my IP address, but I installed the integration just to try it.

And in template:
{{ states('sensor.myip') }}
returns my IP.

@WallyR 's suggestion used the wrong single quotes, and there should be no leading .

In States:


In Template:
image
But, when I use any syntax in Automation, I got '[object Object]' instead of the string of my IP
@stevemann The goal is to update my DNS record in my registar in case of it changes

Show the yaml for your automation.

alias: Mise à jour IP DNS Ha-Paris
description: Mise à jour IP DNS Ha-Paris
triggers:
  - trigger: time_pattern
    hours: /12
conditions: []
actions:
  - action: rest_command.update_gandi_my_record_dns_record
    data:
      rrset_name: ha-paris
      ip: {{states.sensor.myip.state}}
mode: single

But when I save and go back to the code, I got

alias: Mise à jour IP DNS Ha-Paris
description: Mise à jour IP DNS Ha-Paris
triggers:
  - trigger: time_pattern
    hours: /12
conditions: []
actions:
  - action: rest_command.update_gandi_my_record_dns_record
    data:
      rrset_name: ha-paris
      ip:
        "[object Object]": null
mode: single

We’re way out of my experience level, but try:
ip: "{{ states('sensor.myip') }}"

1 Like