ztalbot2000 / homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too
Apache License 2.0
149 stars 13 forks source link

Television characteristic 'Active' not working from GUI #81

Closed mitch7391 closed 3 years ago

mitch7391 commented 3 years ago

Another one for you John that has been on my to-do-list for a while and may have just stumbled across a potential issue; low priority but just thought I would create an issue for it.

Describe The Bug: The Television accessory I have created a shell script for would work when it was a simple Switch with only the characteristic On, but applying the same logic (wol command for on and mosquitto_pub for off) to the characteristic Active has not worked for me.

It would seem when I turn off the TV, I cannot issue the Active 'true' command again; at first I had figured maybe this has something to do with the addition of "linkedTypes" for TV and HDMI input sources and I had not set these up right. I am now thinking it has something to do with the characteristic Active itself and the GUI instead. The odd thing is if I set Active to true or false from my terminal, it works perfectly; but when I do it from the GUI; it does not work. Proof of working commands below.

Logs:

pi@homebridge:~ $ bash -x /home/pi/HisenseTV.sh Set TELEVISION Active false
+ ip=192.168.0.156
+ port=36669
+ '[' Set = Get ']'
+ '[' Set = Set ']'
+ case "$3" in
+ '[' false = true ']'
+ mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h 192.168.0.156 -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/tv/remote_service/8C:84:01:20:57:18/actions/sendkey -m KEY_POWER
+ exit 0
pi@homebridge:~ $ bash -x /home/pi/HisenseTV.sh Set TELEVISION Active true
+ ip=192.168.0.156
+ port=36669
+ '[' Set = Get ']'
+ '[' Set = Set ']'
+ case "$3" in
+ '[' true = true ']'
+ wakeonlan 7C:B3:7B:76:77:D4
Sending magic packet to 255.255.255.255:9 with 7C:B3:7B:76:77:D4
+ exit 0
pi@homebridge:~ $

Shell Script:

Click to expand ``` #!/bin/bash ip="192.168.0.156" port="36669" if [ "$1" = "Get" ]; then case "$3" in #Set to 1=CONFIGURED for all inputs added in config.json. IsConfigured ) echo 1 ;; # Set to 0=SHOWN for inputs configured. CurrentVisibilityState ) echo 0 ;; # Polls the TV over your network to see if it is still active. Active ) if [ "$(timeout 2 /bin/bash -c "(echo > /dev/tcp/192.168.0.156/36669)" > /dev/null 2>&1 && echo 1 || echo 0)" = '1' ]; then echo 1 else echo 0 fi ;; ActiveIdentifier ) # For now TV=1 and anything else is HDMI1 as I am keeping it simple with 2 sources if [ "$(timeout 2 /bin/bash -c "(echo > /dev/tcp/192.168.0.156/36669)" > /dev/null 2>&1 && echo 1 || echo 0)" = '1' ]; then input=$(mosquitto_sub --cafile /home/pi/hisense.crt --tls-version tlsv1.2 --insecure -W 1 -h $ip -p $port -P multimqttservice -u hisenseservice -t /remoteapp/mobile/broadcast/ui_service/state | jq '.sourceid') case "$input" in '"TV"' ) echo 0 ;; '"HDMI1"' ) echo 1 ;; esac else echo 0 fi ;; esac fi if [ "$1" = "Set" ]; then case "$3" in Active ) if [ "$4" = "true" ]; then #TV can only be turned back on by WOL using MAC ADDRESS wakeonlan 7C:B3:7B:76:77:D4 else #TV can turn off using MQTT mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h $ip -p $port -P multimqttservice -u hisenseservice -t "/remoteapp/tv/remote_service/8C:84:01:20:57:18$normal/actions/sendkey" -m "KEY_POWER" fi ;; ActiveIdentifier ) case "$4" in #TV 0 ) mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h $ip -p $port -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/8C:84:01:20:57$normal/actions/changesource" -m '{"sourceid":"0","sourcename":"TV"}' ;; #HDMI1 1 ) mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h $ip -p $port -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/8C:84:01:20:57$normal/actions/changesource" -m '{"sourceid":"4","sourcename":"HDMI1"}' ;; esac ;; esac fi exit 0 ```

Config:

Click to expand ```json { "type": "Television", "outputConstants": true, "category": "TELEVISION", "publishExternally": true, "name": "TELEVISION", "active": "ACTIVE", "activeIdentifier": 0, "configuredName": "TELEVISION", "sleepDiscoveryMode": "ALWAYS_DISCOVERABLE", "linkedTypes": [ { "type": "InputSource", "displayName": "TV", "configuredName": "TV", "currentVisibilityState": "SHOWN", "inputSourceType": "TUNER", "isConfigured": "CONFIGURED", "identifier": 0, "targetVisibilityState": "SHOWN", "name": "TV" }, { "type": "InputSource", "displayName": "HDMI 1", "configuredName": "HDMI 1", "currentVisibilityState": "SHOWN", "inputSourceType": "HDMI", "isConfigured": "CONFIGURED", "identifier": 1, "targetVisibilityState": "SHOWN", "name": "HDMI 1" } ], "remoteKey": "SELECT", "polling": [ { "characteristic": "active", "interval": 50, "timeout": 5000 }, { "characteristic": "activeIdentifier", "interval": 50, "timeout": 5000 } ], "stateChangeResponseTime": 1, "state_cmd": "bash /home/pi/HisenseTV.sh" } ```

Environment:

ztalbot2000 commented 3 years ago

Hi Mitch,

I'm not quite awake, but alll constants are upper case. At least that is what I send. Whatever I receive, I automatically uppercase.

Just a quick sleepy thought.

John

On Mon, Jan 25, 2021 at 3:01 AM Mitch Williams notifications@github.com wrote:

Another one for you John that has been on my to-do-list for a while and may have just stumbled across a potential issue; low priority but just thought I would create an issue for it.

Describe The Bug: The Television accessory I have created a shell script for would work when it was a simple Switch with only the characteristic On, but applying the same logic (wol command for on and mosquitto_pub for off) to the characteristic Active has not worked for me.

It would seem when I turn off the TV, I cannot issue the Active 'true' command again; at first I had figured maybe this has something to do with the addition of "linkedTypes" for TV and HDMI input sources and I had not set these up right. I am now thinking it has something to do with the characteristic Active itself and the GUI instead. The odd thing is if I set Active to true or false from my terminal, it works perfectly; but when I do it from the GUI; it does not work. Proof of working commands below.

Logs:

pi@homebridge:~ $ bash -x /home/pi/HisenseTV.sh Set TELEVISION Active false

  • ip=192.168.0.156
  • port=36669
  • '[' Set = Get ']'
  • '[' Set = Set ']'
  • case "$3" in
  • '[' false = true ']'
  • mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h 192.168.0.156 -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/tv/remote_service/8C:84:01:20:57:18/actions/sendkey -m KEY_POWER
  • exit 0 pi@homebridge:~ $ bash -x /home/pi/HisenseTV.sh Set TELEVISION Active true
  • ip=192.168.0.156
  • port=36669
  • '[' Set = Get ']'
  • '[' Set = Set ']'
  • case "$3" in
  • '[' true = true ']'
  • wakeonlan 7C:B3:7B:76:77:D4 Sending magic packet to 255.255.255.255:9 with 7C:B3:7B:76:77:D4
  • exit 0 pi@homebridge:~ $

Shell Script: Click to expand

!/bin/bash

ip="192.168.0.156" port="36669"

if [ "$1" = "Get" ]; then case "$3" in

#Set to 1=CONFIGURED for all inputs added in config.json.
IsConfigured )
  echo 1
  ;;

# Set to 0=SHOWN for inputs configured.
CurrentVisibilityState )
  echo 0
  ;;

# Polls the TV over your network to see if it is still active.
Active )
  if [ "$(timeout 2 /bin/bash -c "(echo > /dev/tcp/192.168.0.156/36669)" > /dev/null 2>&1 && echo 1 || echo 0)"  = '1' ]; then
    echo 1
  else
    echo 0
  fi
  ;;

ActiveIdentifier )
 # For now TV=1 and anything else is HDMI1 as I am keeping it simple with 2 sources
    if [ "$(timeout 2 /bin/bash -c "(echo > /dev/tcp/192.168.0.156/36669)" > /dev/null 2>&1 && echo 1 || echo 0)"  = '1' ]; then

     input=$(mosquitto_sub --cafile /home/pi/hisense.crt --tls-version tlsv1.2 --insecure -W 1 -h $ip -p $port -P multimqttservice -u hisenseservice -t /remoteapp$
     case "$input" in

        '"TV"' )
              echo 0
        ;;

        '"HDMI1"' )
               echo 1
        ;;
     esac

    else
      echo 0
    fi
 ;;

esac fi

if [ "$1" = "Set" ]; then case "$3" in

Active )
  if [ "$4" = "true" ]; then
    #TV can only be turned back on by WOL using MAC ADDRESS
    wakeonlan 7C:B3:7B:76:77:D4

  else
    #TV can turn off using MQTT
    mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h $ip -p $port -P multimqttservice -u hisenseservice -t "/remoteapp/tv/remote_service/8C:84:01:20:57:1$
  fi
;;

ActiveIdentifier )
  case "$4" in
    #TV
    0 )
    mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h $ip -p $port -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/8C:84:01:20:57$norma$
    ;;

    #HDMI1
    1 )
    mosquitto_pub --cafile /home/pi/hisense.crt --insecure -h $ip -p $port -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/8C:84:01:20:57$norma$
    ;;
  esac
;;

esac fi

exit 0

Config: Click to expand

{ "type": "Television", "outputConstants": true, "category": "TELEVISION", "publishExternally": true, "name": "TELEVISION", "active": "ACTIVE", "activeIdentifier": 0, "configuredName": "TELEVISION", "sleepDiscoveryMode": "ALWAYS_DISCOVERABLE", "linkedTypes": [ { "type": "InputSource", "displayName": "TV", "configuredName": "TV", "currentVisibilityState": "SHOWN", "inputSourceType": "TUNER", "isConfigured": "CONFIGURED", "identifier": 0, "targetVisibilityState": "SHOWN", "name": "TV" }, { "type": "InputSource", "displayName": "HDMI 1", "configuredName": "HDMI 1", "currentVisibilityState": "SHOWN", "inputSourceType": "HDMI", "isConfigured": "CONFIGURED", "identifier": 1, "targetVisibilityState": "SHOWN", "name": "HDMI 1" } ], "remoteKey": "SELECT", "polling": [ { "characteristic": "active", "interval": 50, "timeout": 5000 }, { "characteristic": "activeIdentifier", "interval": 50, "timeout": 5000 } ], "stateChangeResponseTime": 1, "state_cmd": "bash /home/pi/HisenseTV.sh" }

Environment:

  • Node.js Version: v14.15.4
  • NPM Version: v6.14.11
  • Homebridge Version: v1.2.5
  • Operating System: Raspbian
  • Process Supervisor: hb-service

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX25D4ZYF2GFHVDTZR3S3UQMLANCNFSM4WRKZMBQ .

mitch7391 commented 3 years ago

Sorry John, I am not sure I get what you mean :)

mitch7391 commented 3 years ago

It would appear that using the On characteristic has helped John as discussed in #82. As a bit of trial and error messing around, by adding the On characteristic in my config and polling, replacing Active ) with On ) in my 'Set' section and piping On ) into Active ) via On | Active ) in my 'Get' section.

I do not feel this is a proper solution but is instead a work-around I have found as looking at the Homebridge API for the Television service type does not define or require the On characteristic. Is this something that needs fixing on your end of things?

ztalbot2000 commented 3 years ago

Hi,

I have not forgot about this. I tried to reproduce it, but could not. It can be very tedious at times and error prone trying. I stopped for a while to complete the Cmd4 Portal on the GitHub pages of https://ztalbot2000.github.io/homebridge-cmd4/autoGenerated/CMD4_AccessoryDescriptions.html Anyway that's done for awhile. I started on your issue again yesterday tackling it from a unit testing perspective. I'm trying to use sinon to pump commands directly into Cmd4Accessory.getValue and Cmd4Accessory.setValue. It's not easy either, but it is the best way to procédé as automating this makes it a continuous process forever. I hope to have an answer soon.

John

ztalbot2000 commented 3 years ago

Hi Mitch,

I just submitted the first actual unit tests of Cmd4Accessory.getValue, unfortunately, I did not find anything that would explain your problem. I do have a thought though and that is to increase the stateChangeResponseTime and timeout values. There is a possibility that recent changes caused them to be borderline responsive. Just a thought. I'm going to figure out how to test setValue now.

ttfn, John

ztalbot2000 commented 3 years ago

Hi Mitch,

I'm still poking. Is it possible it is because the characteristic Active is actually a Uint8 having values of 0 or 1, constants of INACTIVE and ACTIVE compared to the Characteristic On is a bool, which is false/true, constants of FALSE/TRUE? Just writing this I wonder what is being sent compared to what I believe it should be. I guess I'll find out as I finish writing the Cmd4Accessory.setValue unit tests.

ttfn, John

mitch7391 commented 3 years ago

I can definitely try the stateChangeResponseTime and timeout values; but I would not expect these to be the issue. I just find it very curious that adding the On characteristic has helped when according the the specifications it should not be used by the TV at all; maybe it used to be used in older versions of the TV service?

ztalbot2000 commented 3 years ago

Hi Mitch,

I'm not sure. I can look into thiis and let you know. I had called it quits for today, but I can poke around that area tomorrow too. It's an interesting thought.

TTFN, John

On Sat, Jan 30, 2021 at 11:04 PM Mitch Williams notifications@github.com wrote:

I can definitely try the stateChangeResponseTime and timeout values; but I would not expect these to be the issue. I just find it very curious that adding the On characteristic has helped when according the the specifications it should not be used by the TV at all; maybe it used to in older versions of the TV service?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770321859, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCXZFO53LD3DTVFW3WWLS4TJFXANCNFSM4WRKZMBQ .

mitch7391 commented 3 years ago

Just in your own time John, I have a working (albeit unexplained) method at the moment; so don’t lose sleep over it! I just feel like it shouldn’t be the real solution :)

ztalbot2000 commented 3 years ago

So my unit testing of Cmd4Accessory of getValue and setValue all return successfully. I ran through combinations of Active and Mute. They all send 0 or 1, even if they are format bool or uint. If output constant is on then they send "INACTIVE" "ACTIVE" or "FALSE" "TRUE". This is as it has always been, though technically for bool it should send false, true, but I'm not changing history. I ran Cmd4 itself with the configuration of linked types and a TV speaker as described in the Homebridge plugin page. The on button is there and Get/Set is triggered for Active.
I'll have to start debugging with your configuration as best I can. That's all 4 now.

John

mitch7391 commented 3 years ago

Interesting... Are you able to test the ‘on’ button for this setup from the GUI? This is where mine doesn’t work; however, direct use of the command for Set Active true from the terminal (proof in first post) works. And strangely now the addition of the On characteristic which should have no affect has fixed it all...

ztalbot2000 commented 3 years ago

Hey Mitch,

Yeah, mine works. No On characteristic either.

On Mon, Feb 1, 2021 at 12:32 AM Mitch Williams notifications@github.com wrote:

Interesting... Are you able to test the ‘on’ button for this setup from the GUI? This is where mine doesn’t work; however, direct use of the command for Set Active true from the terminal (proof in first post) works. And strangely now the addition of the On characteristic which should have no affect has fixed it all...

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770579224, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX5AEJR3VSZ2WMM4IQDS4Y4HPANCNFSM4WRKZMBQ .

mitch7391 commented 3 years ago

So strange, can it be an issue of working in the shell environment and not outside of it? I haven’t encountered an issue like that yet, but I’m still new at this.

ztalbot2000 commented 3 years ago

I still don't know, but am not refusing to quit.

On Mon, Feb 1, 2021 at 12:36 AM Mitch Williams notifications@github.com wrote:

So strange, can it be an issue of working in the shell environment and not outside of it? I haven’t encountered an issue like that yet, but I’m still new at this.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770581474, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCXZZ3LVVBYP3AZQFGQLS4Y4VZANCNFSM4WRKZMBQ .

mitch7391 commented 3 years ago

Me too! I just wish I could do more than just present problems and have more skills to find the solution haha you should have everything of mine in that first post, but let me know if there is anything else you might need from me or want me to try.

ztalbot2000 commented 3 years ago

I'm not going to give up. Everything I try is a step in the right direction. I especially like the unit tests, because they are easily repeatable against everything I do.

You have been a great help, believe me!

ttfn, John

On Mon, Feb 1, 2021 at 12:40 AM Mitch Williams notifications@github.com wrote:

Me too! I just wish I could do more than just present problems and have more skills to find the solution haha you should have everything of mine in that first post, but let me know if there is anything else you might need from me or want me to try.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770583582, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX6IAEVNULLFPGRM5PLS4Y5DNANCNFSM4WRKZMBQ .

mitch7391 commented 3 years ago

This is good to hear! Ok, the fact that you have confirmed now that there is no issue with the GUI and the Active characteristic means we can cross out that line of thought. Next thought I had was that HomeKit might think the service is still Active and therefore does not execute the Set Active true; this could be because of the linkedTypes still being on or active. I caught this screenshot in a glitch a little while ago where it had not linked them correctly and noticed that HDMI1 was still ‘on’ while the TV was ‘off’. I didn’t bring this up sooner as I wanted to confirm the GUI issue first.

56014804-6D99-4587-95D7-3A09714E9947

ztalbot2000 commented 3 years ago

Just to clarify, it will call Set Active 1 and Set Active 0 as I mentioned a second ago.

On Mon, Feb 1, 2021 at 12:50 AM Mitch Williams notifications@github.com wrote:

This is good to hear! Ok, the fact that you have confirmed now that there is no issue with the GUI and the Active characteristic means we can cross out that line of thought. Next thought I had was that HomeKit might think the service is still Active and therefore does not execute the Set Active true; this could be because of the linkedTypes still being on or active. I caught this screenshot in a glitch a little while ago where it had not linked them correctly and noticed that HDMI1 was still ‘on’ while the TV was ‘off’. I didn’t bring this up sooner as I wanted to confirm the GUI issue first.

[image: 56014804-6D99-4587-95D7-3A09714E9947] https://user-images.githubusercontent.com/40288237/106419793-3a3dd400-6494-11eb-93eb-364ce3c4aba0.png

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770588806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX2TKATNJVNGMS42PCLS4Y6JTANCNFSM4WRKZMBQ .

ztalbot2000 commented 3 years ago

Active is not a Boolean type. It is uint

On Mon, Feb 1, 2021 at 12:53 AM John Talbot ztalbot2000@gmail.com wrote:

Just to clarify, it will call Set Active 1 and Set Active 0 as I mentioned a second ago.

On Mon, Feb 1, 2021 at 12:50 AM Mitch Williams notifications@github.com wrote:

This is good to hear! Ok, the fact that you have confirmed now that there is no issue with the GUI and the Active characteristic means we can cross out that line of thought. Next thought I had was that HomeKit might think the service is still Active and therefore does not execute the Set Active true; this could be because of the linkedTypes still being on or active. I caught this screenshot in a glitch a little while ago where it had not linked them correctly and noticed that HDMI1 was still ‘on’ while the TV was ‘off’. I didn’t bring this up sooner as I wanted to confirm the GUI issue first.

[image: 56014804-6D99-4587-95D7-3A09714E9947] https://user-images.githubusercontent.com/40288237/106419793-3a3dd400-6494-11eb-93eb-364ce3c4aba0.png

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770588806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX2TKATNJVNGMS42PCLS4Y6JTANCNFSM4WRKZMBQ .

ztalbot2000 commented 3 years ago

That screenshot is a weird glitch. I wonder if that is a restart issue?

On Mon, Feb 1, 2021 at 12:55 AM John Talbot ztalbot2000@gmail.com wrote:

Active is not a Boolean type. It is uint

On Mon, Feb 1, 2021 at 12:53 AM John Talbot ztalbot2000@gmail.com wrote:

Just to clarify, it will call Set Active 1 and Set Active 0 as I mentioned a second ago.

On Mon, Feb 1, 2021 at 12:50 AM Mitch Williams notifications@github.com wrote:

This is good to hear! Ok, the fact that you have confirmed now that there is no issue with the GUI and the Active characteristic means we can cross out that line of thought. Next thought I had was that HomeKit might think the service is still Active and therefore does not execute the Set Active true; this could be because of the linkedTypes still being on or active. I caught this screenshot in a glitch a little while ago where it had not linked them correctly and noticed that HDMI1 was still ‘on’ while the TV was ‘off’. I didn’t bring this up sooner as I wanted to confirm the GUI issue first.

[image: 56014804-6D99-4587-95D7-3A09714E9947] https://user-images.githubusercontent.com/40288237/106419793-3a3dd400-6494-11eb-93eb-364ce3c4aba0.png

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770588806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX2TKATNJVNGMS42PCLS4Y6JTANCNFSM4WRKZMBQ .

mitch7391 commented 3 years ago

So that means I would need outputConstants set to false; which I currently have it set to true.

Yeah I have had the glitch once or twice where it separates them; a restart always fixes it. But took a screenshot in case the linkedType being ‘on’ while the main service is ‘off’ is what is stopping me from turning it on (active); due to thinking something in the service is already ‘on’. If you get my thought process.

ztalbot2000 commented 3 years ago

Output constants set to false will make active send 0 or 1 as it is supposed to, being a uint format. Having outputConstants set to true it would send the strings "INACTIVE' or "ACTIVE"

Bool types send 0 or 1 with outputConstants set to false and the strings "FALSE" "TRUE" when outputConstants is true.

As for the restart glitch, I'll test these tomorrow. I've never seen it myself.

TTFN, John

On Mon, Feb 1, 2021 at 1:01 AM Mitch Williams notifications@github.com wrote:

So that means I would need outputConstants set to false; which I currently have it set to true.

Yeah I have had the glitch once or twice where it separates them; a restart always fixes it. But took a screenshot in case the linkedType being ‘on’ while the main service is ‘off’ is what is stopping me from turning it on (active); due to thinking something in the service is already ‘on’. If you get my thought process.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770593727, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX6WLCZOQQ6LYIJ7T53S4Y7SDANCNFSM4WRKZMBQ .

ztalbot2000 commented 3 years ago

Gotta go back to bed. Ttyl.

John

On Mon, Feb 1, 2021 at 1:06 AM John Talbot ztalbot2000@gmail.com wrote:

Output constants set to false will make active send 0 or 1 as it is supposed to, being a uint format. Having outputConstants set to true it would send the strings "INACTIVE' or "ACTIVE"

Bool types send 0 or 1 with outputConstants set to false and the strings "FALSE" "TRUE" when outputConstants is true.

As for the restart glitch, I'll test these tomorrow. I've never seen it myself.

TTFN, John

On Mon, Feb 1, 2021 at 1:01 AM Mitch Williams notifications@github.com wrote:

So that means I would need outputConstants set to false; which I currently have it set to true.

Yeah I have had the glitch once or twice where it separates them; a restart always fixes it. But took a screenshot in case the linkedType being ‘on’ while the main service is ‘off’ is what is stopping me from turning it on (active); due to thinking something in the service is already ‘on’. If you get my thought process.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/81#issuecomment-770593727, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX6WLCZOQQ6LYIJ7T53S4Y7SDANCNFSM4WRKZMBQ .

ztalbot2000 commented 3 years ago

Hey Mitch,

So on the shell script attached to this ticket. You have a if [ "$1" = "Set" ]; then case "$3" in Active ) if [ "$4" = "true" ]; then

So the format of Active is Uint not bool. Therefore the check should be for "1" not "true". I looked at the code for Cmd4 v2.4.2. I believe it also always outputted "1'. I don't want to spend to much time looking backwards though. If this is the fix for your issue, let me know.

I noticed the script you updated in another ticket. You do check for either Active or On with the correct values for each, that being "1"

I'm going to try now playing with restarting Cmd4 with liked types to see if I get the image you attached.

I've also just noticed that CMD4 TV's do not show in "Eve", but neither does the Homebridge example they give. So I'm not sure what is going on there either.

ttfn, John Talbot

mitch7391 commented 3 years ago

Ohhhhhhh... Yes, this explains why the On suddenly helps my shell script! Wow this is something so simple and stupid haha and a problem inherited from my shell scripts for my thermostat work (used as the base work). I will give this a try tonight after work and will update you on how it goes! :)

ztalbot2000 commented 3 years ago

Hey Mitch,

I tried through out the day restarting Homebridge and could not get the pic you posted. I did just publish 3.014, it removes some dead code and a console statement that I left around.if anything, it might be a little faster.

I still need you to check out, when you get a chance, your script as previously mentioned to resolve the active issue. Thanks for helping that fella who has a TV like yours. Much appreciated.

ttfn, John

mitch7391 commented 3 years ago

In terms of trying to replicate the splitting issue showed in the screenshot; the few times I have seen it is when creating a new TV accessory and you may need to delete your cache each time.

I made the change to my script and... It is all working now! I'm so glad that it was such a simple fix in the end :) now to work on making the rest of the TV config work and update my new repo! Thank you again so much for your help John!

ztalbot2000 commented 3 years ago

After much work by all, I'm glad to close this one.