Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Error for 'Child Lock', 'Angle', 'Timer' and 'Natural Mode' #108

Closed
JayZiii opened this issue Apr 19, 2021 · 20 comments
Closed

Service Error for 'Child Lock', 'Angle', 'Timer' and 'Natural Mode' #108

JayZiii opened this issue Apr 19, 2021 · 20 comments

Comments

@JayZiii
Copy link

JayZiii commented Apr 19, 2021

Hi there,

is there an Issue with some Services ?

When i try to set up 'Child Lock', 'Angle', 'Timer' and 'Natural Mode'i got this Error:

Failed to call service fan/xiaomi_miio_set_child_lock_on. Service not found.

So every Xiaomi Fan Service from the intergeration doesn't work.

@JayZiii JayZiii changed the title Service Error for 'Child Lock', 'Angle' and 'Timer' Service Error for 'Child Lock', 'Angle', 'Timer' and 'Natural Mode' Apr 19, 2021
@syssi
Copy link
Owner

syssi commented Apr 19, 2021

Which device do you own? The service is called fan_set_child_lock_on. It's possible the docs aren't up-to-date. I will care about.

@syssi syssi closed this as completed Apr 19, 2021
@syssi syssi reopened this Apr 19, 2021
@syssi
Copy link
Owner

syssi commented Apr 19, 2021

TODO: Fix the docs

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

I used Raspberry Pi with Conbee Stick II

When i call the service from developer tools it works

For example:
service: xiaomi_miio_fan.fan_set_child_lock_off

In editor from the lovelace:

this.log(`Set child lock to: Off`)
                        hass.callService('fan', 'xiaomi_miio_set_child_lock_off')
                        u.innerHTML = 'Off'

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

Please don't use xiaomi_miio_set_child_lock_off. The service was renamed to fan_set_child_lock_off.

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

But the Service does not exist ? Where do i have to change it ?

grafik

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

You are mixing things up. May be this helps:

# Check the domain and entity id. You are using

this.log(`Set child lock to: Off`)
                        hass.callService('fan', 'xiaomi_miio_set_child_lock_off')
                        u.innerHTML = 'Off'

# it should be

this.log(`Set child lock to: Off`)
                        hass.callService('xiaomi_miio_fan', 'fan_set_child_lock_off')
                        u.innerHTML = 'Off'

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

i fixed it but nothing changes..

        // Child lock event bindings
        ui.querySelector('.button-childlock').onclick = () => {
            this.log('Child lock')
            if (ui.querySelector('.fanbox').classList.contains('active')) {
                let b = ui.querySelector('.button-childlock')
                if (!b.classList.contains('loading')) {
                    let u = ui.querySelector('.var-childlock')
                    let oldChildLockState = u.innerHTML
                    let newAngle
                    if (oldChildLockState === 'On') {
                        this.log(`Set child lock to: Off`)
                        hass.callService('xiaomi_miio_fan', 'fan_set_child_lock_off')
                    u.innerHTML = 'OFF'
                    } else if (oldChildLockState === 'Off') {
                        this.log(`Set child lock to: On`)
                        hass.callService('xiaomi_miio_fan', 'fan_set_child_lock_on')
                        u.innerHTML = 'ON'
                    } else {
                        this.error(`Error setting child lock. oldChildLockState = ${oldChildLockState}`)
                        this.error(`Defaulting to Off`)
                        u.innerHTML = 'Off'
                    }
                    b.classList.add('loading')

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

So i reinstalled the Lovelace Card an the Fan Integration.. but nothing changed.

I always get the same Error:

Failed to call service fan/xiaomi_miio_set_child_lock_on. Service not found.

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

Could you tell me the name of the lovelace card?

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

Yes it's the Xiaomi Fan Lovelace Card

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

Could you create an issue here because the lovelace card is incompatible with the current version of xiaomi_miio_fan.

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

A new one or can you use this one ?

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

I'm the developer of the custom component (-> the integration). I'm not the author of the lovelace card!

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

Are we talking about this card? https://github.com/fineemb/lovelace-fan-xiaomi

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

yes that's it

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

Could you create an issue here? https://github.com/fineemb/lovelace-fan-xiaomi/issues

@JayZiii
Copy link
Author

JayZiii commented Apr 19, 2021

Yes, it's done.

fineemb/lovelace-fan-xiaomi#4

Thank you very much !

@syssi
Copy link
Owner

syssi commented Apr 19, 2021

I've updated the docs.

@craxo
Copy link

craxo commented Apr 26, 2021

I think there might be a misunderstanding here: The code snippet above is not from the linked repository but rather this one created by @ikaruswill.

@syssi
Copy link
Owner

syssi commented May 8, 2021

I will close this issue because it cannot be solved here. The relevant lovelace card must be updated.

@syssi syssi closed this as completed May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants